1. Serialize JavaScript object to JSON
var messageObject = { title: 'Hello World!', body: 'It\'s great!' }; var serializedJSON = JSON.stringify( messageObject ); });
2. Parse JSON to Javascript Object
var serializedJSON = '{"title":"Hello World!","body":"It\'s great!"}'; var message = JSON.parse( serializedJSON );
时间: 2024-09-19 22:18:31