Json:javascript Object Notation (JavaScript Object notation), in fact, JSON is a JavaScript object.
If there is no clear json, you can go to w3cschool understand http://www.w3school.com.cn/json/
1. Create a new string (JSON text) in JavaScript.
The first: Eval method parsing
[JavaScript] view plain copy function Strtojson (str) {var json = eval (' + str + ') '); return JSON; }Second: form of new function
[JavaScript] view plain copy function Strtojson (str) {var json = (new function
JSON syntaxJSON is constructed in two structures:Object-A collection of name/value pairs. In different languages, it is understood as objects, records, structures, dictionaries, hash tables, a list of keys (keyed list), or associative arrays. An
In the development process, it seems that very few people go to add an extra window, feel superfluous. Like the Ajax process, the callback function parses the JSON format stringCopy code code as follows:...
function Callback (str) {
var json =
Includes global JSON objects and date Tojson methods.
1,eval Way of parsing, I am afraid this is the earliest analytic way.
View sourceprint?1 function Strtojson (str) {
2 var json = eval (' (' + str + ') ');
3 return JSON;
4}
Javascript has built-in conversion functions: String.fromcharcodeat (), string.charcodeat () for converting between strings and encodings.
So what we're going to do with the string is actually very simple, we can get the Unicode encoding of the
Javascript| Programming | objects
Object-oriented JavaScript programming should not be unfamiliar to people who have done Web applications, initially to do some simple form validation, basically playing with some technical things. IE 4.0 introduced
JSON (JavaScript Object notation) is a lightweight data interchange format that uses a completely language-independent text format and is an ideal data interchange format. Also, JSON is the native format of JavaScript, which means that processing
Are there any differences between them?In the development process, it seems that very few people go to add an extra window, feel superfluous. Like the Ajax process, the callback function parses the JSON format string
Copy Code code as follows:
Overview
The JSON format is now becoming more and more important in web development, especially in the process of using AJAX development projects, which often involves returning JSON-formatted strings to the front end and parsing the front end into
Data type: Computer as the name implies (can do computing machine), the computer can not only handle the numerical value, but also processing pictures, text, audio, video, Web pages and other kinds of data, different data will define different data
Instance one,
In JS, the JSON-formatted string is converted to a JSON object, and the key code
The code is as follows
Copy Code
JSON = eval (' (' +str+ ') ');
The method is as follows:
The code is
1. Creating Regular ExpressionsThe first way: note that the regular expression here cannot use single or double quotes, as follows
var pattern1 =/[abc]/i; Match the first "a" or "B" or "C", case-insensitive
The second way: created using the RegExp
Function description
int (x [, Base]) converts x to an integer
Long (x [, Base]) converts x to a long integer
Float (x) converts x to a floating-point number
Complex (real [, Imag]) creates a complex number
STR (x) converts an object x to a
In the development project using AJAX, it is often necessary to return the JSON-formatted string to the front end and parse the front end into a JS object (JSON).
ECMA-262 (E3) did not write the JSON concept into the standard, but fortunately in
First, prefaceas with XML, JSON is also a data format based on plain text. Since JSON is inherently prepared for JavaScript, the JSON data format is very simple, you can transfer a simple string,number,boolean with JSON, or you can transfer an array,
Use to: Jquery.js and Newtonsoft.Json.dllClient Invocation Method:$ ("#ButAjax"). Click (function () {$.ajax ({Type: "POST",//default is getURL: "/ajaxtest/getperson",Data: "Id=1&firstname=c&lastname=hy",Async:true,//AsyncCache:false,//Do not load
A simple calculation command Evalvar str= "6*5"; Alert (eval (str));Note:Not safe, generally not to use two, id&&name
ID: can only be unique
Name: can have multiple, can be used in the array
three, apply for a global variablevar
Python Learning Note _python Object
Python Object
Standard type
Other built-in types
Type Object and type Object
Null object of Python None
Standard type operator
Comparison of object values
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.