admin管理员组

文章数量:1302937

I would like to serialize an instance of JS object from the Server-side to the Client side (the object contains data members and functions)

I have a Javascript stack on both end, all my users use Chrome and My server side is a NodeJS impl..

how would I do it? It should be trivial as my server is a Javascript one..

I would like to serialize an instance of JS object from the Server-side to the Client side (the object contains data members and functions)

I have a Javascript stack on both end, all my users use Chrome and My server side is a NodeJS impl..

how would I do it? It should be trivial as my server is a Javascript one..

Share edited Aug 2, 2010 at 17:00 Robert Harvey 181k48 gold badges348 silver badges513 bronze badges asked Aug 1, 2010 at 9:39 user407854user407854
Add a ment  | 

1 Answer 1

Reset to default 9

You could send it as JSON string. Here's an example:

response.writeHead(200, {'Content-Type': 'application/json'});
response.write(JSON.stringify(yourObject));
response.close();

本文标签: Serialization of Javascript from Server(NodeJS) to BrowserStack Overflow