Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Value parameter will be smartly interpreted by the routine unless a Hint is specified. OI numbers are converted into json numbers. You can also pass json as a value, and this routine will parse the json and set it as the current element's value. Note. You can even pass partial json. For example, let's say every object has a "type" member, you can open a new object with the member in one call, leaving the object open for further calls to SRP_JsonX:

Code Block
// we are currently in an array of employees, let's add a manager
// notice how we opened an object with a "type" member and left it open so we could add other members later
SRP_JsonX('{"type":"manager"')
	SRP_JsonX('firstname', 'Sarah')
	SRP_JsonX('lastname', 'Marshall')
	SRP_JsonX('age', 32)
SRP_JsonX('}')

The Hint parameter can be used to force the value into a specific json type. Use "Bool" to force the value to be true or false. Use "Null" to ignore the given value and just use null as the value. Use "String" to force the value into a string, which is useful when you want an OI number to be surrounded by quotes in the json itself.

...