Versions Compared

Key

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

...

Code Block
// Create the root object, which we'll call employees
If SRP_Json(EmployeesHandle, "New") then
   
   // Create a new array
   If SRP_Json(EmployeeArrayHandle, "New", "ARRAYArray") then
       
       // Add the first employee
       If SRP_Json(SingleEmployeeHandle, "New") then
           SRP_Json(SingleEmployeeHandle, "SetValue", "firstName", "John")
           SRP_Json(SingleEmployeeHandle, "SetValue", "lastName", "Doe")
           SRP_Json(EmployeeArrayHandle, "Add", SingleEmployeeHandle)
           SRP_Json(SingleEmployeeHandle, "Release")
       end
       
       // Add the second employee
       If SRP_Json(SingleEmployeeHandle, "New") then
           SRP_Json(SingleEmployeeHandle, "SetValue", "firstName", "Anna")
           SRP_Json(SingleEmployeeHandle, "SetValue", "lastName", "Smith")
           SRP_Json(EmployeeArrayHandle, "Add", SingleEmployeeHandle)
           SRP_Json(SingleEmployeeHandle, "Release")
       end
       
       // Add the third employee
       If SRP_Json(SingleEmployeeHandle, "New") then
           SRP_Json(SingleEmployeeHandle, "SetValue", "firstName", "Peter")
           SRP_Json(SingleEmployeeHandle, "SetValue", "lastName", "Jones")
           SRP_Json(EmployeeArrayHandle, "Add", SingleEmployeeHandle)
           SRP_Json(SingleEmployeeHandle, "Release")
       end
       
       // Now add the array as a member of the root object
       SRP_Json(EmployeesHandle, "Set", "employees", EmployeeArrayHandle)
       
       // All done with the array object
       SRP_Json(EmployeeArrayHandle, "Release")
   
   end
   
   // Now get the actual JSON
   SampleJSON = SRP_Json(EmployeesHandle, "Stringify", "STYLED")
   
   // All done with the root object
   SRP_Json(EmployeesHandle, "Release")
   
end

...

ServiceDescription
AddAdds a JSON Entity to a JSON array.
AddValueAdds a value to a JSON array.
AddValueArrayAdds an array of values to a JSON array. New in 2.1.1
ContainsDetermines if a JSON object contains the given member or if a JSON array contains the given index.
GetReturns a descendant JSON Entity within a given JSON Entity.
GetCountReturns the number of members in a JSON object or elements in a JSON array.
GetMembersReturns a list of a JSON object's members.
GetValueReturns a descendant value within a given JSON Entity.
NewCreates a new JSON Entity.
ParseParses a standardized JSON string into a new JSON Entity.
ReleaseDeallocates a JSON Entity from memory.
RemoveRemoves a member from a JSON object or an element from a JSON array.
RemoveAllRemoves all members from a JSON obect or all elements from a JSON array.
SetSets a member within a JSON object or element within a JSON array to the given JSON Entity.
SetValueSets a member within a JSON object or element within a JSON array to the given value.
SetValueArraySets a member within a JSON object or element within a JSON array to the given array of values. New in 2.1.1
StringifyFormats the given JSON Entity into a standardized JSON string.
TypeReturns a JSON Entity's type.
ValidateValidates JSON against a given schema. New in 2.2.1

Click on the service above to read more details.