Versions Compared

Key

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

...

This method's return value is not a JSON Entity Handle; it is a boolean indicating the success or failure of this service. The JSON Entity Handle is instead placed into the variable you pass into the Handle parameter. It is perfectly safe to set Handle to an unassigned variable, but you should check the return value to see if the entity was successfully created, like so:

 

Code Block
If SRP_JSON(NewObjectHandle, "NEW") then
   // Success, the handle now points to a new JSON object
end else
   // Failure, NewObjectHandle is not valid
end

...

Code Block
// Let's create some entities.
Success = SRP_JSON(ObjectHandle, "NEW", "OBJECT")
Success = SRP_JSON(IntegerHandle, "NEW", "NUMBER", "1234567890")
Success = SRP_JSON(DecimalHandle, "NEW", "NUMBER", "123456789.987654321")
Success = SRP_JSON(StringHandle, "NEW", "STRING", "Hello, World!")
Success = SRP_JSON(BooleanHandle, "NEW", "BOOLEAN", 1)
Success = SRP_JSON(ArrayHandle, "NEW", "ARRAY")

// Don't forget to release them when we're done
SRP_JSON(ArrayHandle, "RELEASE")
SRP_JSON(BooleanHandle, "RELEASE")
SRP_JSON(StringHandle, "RELEASE")
SRP_JSON(DecimalHandle, "RELEASE")
SRP_JSON(IntegerHandle, "RELEASE")
SRP_JSON(ObjectHandle, "RELEASE")

See Also

PARSERELEASE