This article mainly introduces the skills of regular expressions to optimize JSON strings. For more information, see json strings. Sometimes the information returned by some background interfaces is in string format, poor readability. In this case,
The theory and technique are explained in detail, the practical development work is of great significance.The syntax of JSON can represent the following three types of values. Simple Values: Using the same syntax as JavaScript, you can represent
RoughlyIntroduction JSON (javascript object Notation JavaScript Objects notation), JSON is a data format, not a programming language. Although it has JavaScript in its name, it does not belong to javascript, as is the case with Java and Javascript.
JSON (JavaScript Object Notation) is a lightweight data interchange format. It is based on a subset of ECMAScript, with a completely language-independent text format. These features make JSON an ideal data exchange language. Easy to read and write,
Use regular expressions to format and highlight json strings.
Json strings are very useful. Sometimes the information returned by some background interfaces is in string format, which is quite readable. In this case, it would be much better to have
JSON (JavaScript Object Notation) is a lightweight data interchange format. It is based on a subset of ECMAScript, with a completely language-independent text format. These features make JSON an ideal data exchange language. Easy to read and write,
Implementation using native Json.stringifyTwo own Write function realization
https://jsfiddle.net/q2gnX/
Online preview//Notes://-json2.js is not needed if browser supports json.stringify and Json.parse natively//-JQuery is only used
This example describes the JavaScript formatted JSON display method. Share to everyone for your reference. The specific analysis is as follows:
Format a JSON object or JSON string to easily restrict on a Web page
var Formatjson = function
One: 4 ways of front-end string to JSON1,eval way to parse, I am afraid this is the earliest way to parse.function Strtojson (str) { var json = eval (' (' + str + ') '); return JSON;}2,new function form, more strange oh.function Strtojson
javascript formats JSON display .
Examples of JavaScript operation JSON format of the relevant skills, very practical value, the need for friends can refer to the
This example describes the JavaScript formatted JSON display method. Share to
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.