I try to convert a javascript object into string, but i just cannot get the solution after Google on it. Can someone help me about it? Thanks first...

Recommended Answers

Refer to:
https://github.com/douglascrockford/JSON-js/blob/master/json2.js

You will need to "import" that js script into your page, then call JSON.stringify( obj ) -ex:

<script type="text/javascript" src="/javascript/json2.js"></script>
<script type="text/javascript">
var settings={"username":"xxx","password":"secret"};
alert( JSON.stringify( …
Jump to Post

All 3 Replies

Refer to:
https://github.com/douglascrockford/JSON-js/blob/master/json2.js

You will need to "import" that js script into your page, then call JSON.stringify( obj ) -ex:

<script type="text/javascript" src="/javascript/json2.js"></script>
<script type="text/javascript">
var settings={"username":"xxx","password":"secret"};
alert( JSON.stringify( settings ) );
</script>

you are the man...save my day.thanks.

Glad to help.

Regards,
Hielo
PS: Don't forget to mark the thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.