function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sudip MondalSudip Mondal 

JSON Validation

Hello fellow members,

We have a requirement to check if a value entered in a textbox by the user is in valid JSON format. Is there any specific way we can implement this? Looking forward not to use triggers and to complete this using Validation Rules.

Many thanks in advance.
pconpcon
There is not a way to do this without code.  You could do this in a couple of different ways with code:
  • VisualForce page with Javascript to call a JSON linter / validate with the built in JSON parser
  • VisualForce page with Apex controller to call JSON methods to validate
  • Trigger on object insert to call Apex JSON methods to validate
You might be able to validate by injecting Javascript via a sidebar hack, but that's going to be going away soon so I wouldn't recommend doing that.