Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON.parse()与JSON.stringify()的区别 #83

Open
Seasons123 opened this issue Aug 14, 2018 · 0 comments
Open

JSON.parse()与JSON.stringify()的区别 #83

Seasons123 opened this issue Aug 14, 2018 · 0 comments

Comments

@Seasons123
Copy link
Owner

Seasons123 commented Aug 14, 2018

1. JSON.parse()【从一个字符串中解析出json对象】
JavaScript 对象表示法 将 (JSON) 字符串转换为对象。

例子:

//定义一个字符串

var data='{"name":"goatling"}'

//解析对象​

​JSON.parse(data)

结果是:

​name:"goatling"

2. JSON.stringify()【从一个对象中解析出字符串】

var data={name:'goatling'}

JSON.stringify(data)

结果是:

'{"name":"goatling"}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant