Versions Compared

Key

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

...

Code Block
// Create a JSON array
If SRP_Json(ArrayHandle, "New", "ARRAYArray") then
   
   // Add elements to it
   SRP_Json(ArrayHandle, "AddValue", "12345")
   SRP_Json(ArrayHandle, "AddValue", 67890, "NUMBERNumber")
   SRP_Json(ArrayHandle, "AddValue", 1, "BOOLEANBoolean")
   
   // Get the count, which is currently 3
   Count = SRP_Json(ObjectHandle, "GetCount")
   
   // Delete everything and get the count again, which will be 0
   Result = SRP_Json(ArrayHandle, "RemoveAll")
   Count = SRP_Json(ArrayHandle, "GetCount")
   
   SRP_Json(ArrayHandle, "Release")
   
 end

// Create a JSON object
If SRP_Json(ObjectHandle, "New", "OBJECTObject") then
   
   // Add members to it
   SRP_Json(ObjectHandle, "SetValue", "name", "John Doe")
   SRP_Json(ObjectHandle, "SetValue", "city", "Washington D.C.")
   
   // Get the count, which is currently 2
   Count = SRP_Json(ObjectHandle, "GetCount")
   
   // Delete everything and get the count again, which will be 0
   Result = SRP_Json(ObjectHandle, "RemoveAll")
   Count = SRP_Json(ObjectHandle, "GetCount")
   
   SRP_Json(ObjectHandle, "Release")
   
 end

...