Page History
...
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 |
...
Service | Description |
---|---|
Add | Adds a JSON Entity to a JSON array. |
AddValue | Adds a value to a JSON array. |
AddValueArray | Adds an array of values to a JSON array. New in 2.1.1 |
Contains | Determines if a JSON object contains the given member or if a JSON array contains the given index. |
Get | Returns a descendant JSON Entity within a given JSON Entity. |
GetCount | Returns the number of members in a JSON object or elements in a JSON array. |
GetMembers | Returns a list of a JSON object's members. |
GetValue | Returns a descendant value within a given JSON Entity. |
New | Creates a new JSON Entity. |
Parse | Parses a standardized JSON string into a new JSON Entity. |
Release | Deallocates a JSON Entity from memory. |
Remove | Removes a member from a JSON object or an element from a JSON array. |
RemoveAll | Removes all members from a JSON obect or all elements from a JSON array. |
Set | Sets a member within a JSON object or element within a JSON array to the given JSON Entity. |
SetValue | Sets a member within a JSON object or element within a JSON array to the given value. |
SetValueArray | Sets a member within a JSON object or element within a JSON array to the given array of values. New in 2.1.1 |
Stringify | Formats the given JSON Entity into a standardized JSON string. |
Type | Returns a JSON Entity's type. |
Validate | Validates JSON against a given schema. New in 2.2.1 |
Click on the service above to read more details.