Format and validate JSON using Jsonlint

Source: Internet
Author: User
Tags auth json readable reserved jsonlint

People who are basically engaged in web development should not be unfamiliar with Douglas Crockford. This dingding famous person once was Yahoo Advanced JS architect, now is PayPal's senior JS architect. It creates the well-known JSON data type, which allows the web world to propagate data in a more streamlined and readable type than XML, as follows (the middle tall and temperamental):

He created the Jsonlint, and today we have a brief introduction.

Because many colleagues, like running a Java unit test or something, sometimes print out a JSON string, the JSON string is lined up and hard to read, especially if you want to know the logical relationship of this payload and the front-end developers who want to deal with it further.

Like the following one jsonpayload:

{' Result ': ' OK ', ' type ': ' Masterdetail ', ' displaytables ': [{' Name ': ' Payment Details for Payment Handle: bo-nitz1-5678912340_12345_69 or Order id:bo-nitz1-69 "," Columns ": [" OrderDate "," lastupdate "," Order "," Invoice "," Paymenthandle "," Status "," Reserved "," captured "," Canceled "," refunded "," Client "," Clientreqid "," Cookie "," Ppayid "], "Rows": [["2012-08-23", "2012-08-23", "bo-nitz1-69", "567891234x069", "bo-nitz1-5678912340_12345_69", "RESERVED", "30 "," 0 "," 0 "," 0 "," Bo-cart "," bo-cart5678912340_691 "," {\ "redlptransactions\": {\ "auth1345768366239\": {\ " Transactiontype\ ": \ auth\", "timestamp\": \ "Thu Aug PDT 17:32:46", "2012\": \ "moptypecd\", "vi\": \ " 630001301505\ ", \" origreqid\ ": \" \ "," ordid\ ": \" 567891234x069\ "," userid\ ": \" bo-nitz1-69\ ", \" actcd\ ": \" Oa\ "," " statcd\ ": \ approve\", "rspcd\": \ "100\", "rspdt\": \ "2012-08-23\", "rsptm\": \ "17:32:55\", "rspauthnum\": \ "12345\ ", \" rspavscd\ ": \" y\ "," rspseccd\ ": \" m\ "," divnum\ ": \" fdsdiv\ "," amt\ ": \" 3000\ "," currencycd\ ": \" usd\ "," reqtypecd\ ": \ s\", \ "tdsxid\": \ "3838393030323833353336313630303732303932\ ", \" tdscavv\ ": \" 0800020945089473704895114708940000000000\ ", \" sKeyId\ ": \" 2\ "}}", "8a7263a8395550a80139560b9fa00004"],[["Mod Date", "Trans", "state", "Client", "Order", "Invoice", "Pihash", "Amount", " Reasoncode "," Paymenthandle "," Plugin "," Endpoint "," Req Start "," Req End "," Secret sauce "," clientreqid "," PMID "," Testmode "," Cr1 "," Cr2 "," Cr3 "," Cr4 "," Idcheck "," AVS "," CreateDate "," Plugin start "," Plugin End "," GW start "," GW End "," Redoreqid "," Preqid "," Ppayid "]],[" 2012-08-23 "," paydobeforeshipping "," SUCCESS "," Bo-cart "," bo-nitz1-69 "," 567891234x069 "," pih.pangpidb.visa.creditcard.30000924.2227 "," "", "A101", "bo-nitz1-5678912340_12345_69", " Paymentredlpplugin "," Fdsdiv "," 2012-08-23 17:32:45.92 "," 2012-08-23 17:32:46.24 "," {\ "transactiontype\": \ "AUTH\", \ " Timestamp\ ":" "Thu Aug 17:32:46 PDT 2012\", "moptypecd\": \ "Vi\", "reqid\": \ "630001301505\", \ "origreqid\": \ "\", " Ordid\ ": \ 567891234x069\", "userid\": \ "bo-nitz1-69\", "actcd\": \ "Oa\", "statcd\": \ "approve\", "rspcd\": \ "100\" , \ "rspdt\": \ "2012-08-23\ ", \" rsptm\ ": \" 17:32:55\ "," rspauthnum\ ": \" 12345\ "," rspavscd\ ": \" y\ ", \" rspseccd\ ": \" m\ "," divnum\ ": \" Fdsdiv\ ", \" amt\ ": \" 3000\ "," currencycd\ ": \" usd\ "," reqtypecd\ ": \" s\ ", \" tdsxid\ ": \" 3838393030323833353336313630303732303932\ ", \" tdscavv\ ": \" 0800020945089473704895114708940000000000\ "," sKeyId\ " : \ "2\"} "," bo-cart5678912340_691 "," VISA "," N "," 201604 "," XXX "," Credential 3 "," Credential 4 "," 05; 88900283536160072092; Caaccuuilhnwsjurrwiuaaaaaaa= "," {null} "," 2012-08-23 "," 2012-08-23 17:32:46.05 "," 2012-08-23 17:32:46.239 "," 2012-08-23 17:32:46.051 "," 2012-08-23 17:32:46.238 "," {null} "," 8a7263a8395550a80139560b9fa10005 "," 8a7263a8395550a80139560b9fa00004 "]]}," errormessages ": null}

So how can you quickly make it readable and verify that the JSON is legitimate? That's when we need the jsonlint created by the father of JSON:

Go to the following website: http://jsonlint.com/

We just need it. Jsonpayload pasted into the text box before the format for the checksum:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.