Versions Compared

Key

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

...

The Validate service validates JSON against a schema. There are two ways to do this. If you already parsed your JSON into a handle, you can validate that JSON by passing the handle and leaving the Json parameter blank. If you have unparsed JSON you want to validate, then pass "" as the handle and pass the unparsed JSON via the Json property. In either case, this service will return "1" if the JSON is successfully validated. If the validation fails, a string is returned explaining the error.

Visit json-schema.org to learn about schemas. This service uses Draft-07 of Json Schema.

Example

Code Block
// Validate unparsed json
Result = SRP_Json("", "Validate", Schema, Json)

// Validate parsed json
If SRP_Json(Handle, "Parse", Json)
    Result = SRP_Json(Handle, "Validate", Schema)
    SRP_Json(Handle, "Release")
End

...