top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

How to Validate JSON in PHP?

0 votes
14 views
posted Jul 15 by Biswajit Maity
Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

Suppose a string contains the json string and you want to validate if it is correct as per json standard. Follow the following simple code -

$decoded_json = json_decode($json);
if($decoded_json === null) {
 // $decoded_json is null because json cannot be decoded
}
answer Jul 15 by Salil Agrawal

Your answer

Preview

Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...