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
7 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

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