Forum Moderators: open

Message Too Old, No Replies

converting javascript object to string

converting javascript object to string

         

webdesignservice

3:58 pm on Apr 10, 2011 (gmt 0)

10+ Year Member



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...

mbabuskov

9:46 pm on Apr 10, 2011 (gmt 0)

10+ Year Member



If it's one of the built-in JS types, you can use toString() method.

If it's the object you build, you need to build the string yourself, by combining stuff returned by toString for each object attribute. Make sure the created string is in JSON notation.

Since, this is a common task, there are ready-made functions and libraries that implement this functionality. For example, google for json.stringify

webdesignservice

1:17 pm on Apr 11, 2011 (gmt 0)

10+ Year Member



thanks a lot for your help. thanks.