top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to Validate JSON in PHP?

0 votes
How to Validate JSON in PHP?
posted Jul 15, 2017 by Biswajit Maity

Share this question
Facebook Share Button Twitter Share Button LinkedIn 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, 2017 by Salil Agrawal
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.