Hi, Native JSON parsing is available in latest browsers like firefox 3.1+ and IE 8 and others. so check if ur using latest browser versions. pls visit http://blog.mozilla.com/webdev/2009/02/12/native-json-in-firefox-31/
If ur using browsers which dont support native JSON, then u might have to use a separate js library to make it work ; u can also use eval() but its not safe ! HTH Krishna ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On Fri, Mar 5, 2010 at 8:44 AM, Mirko Kiefer <[email protected]> wrote: > Hi, > I'm trying to parse a JSON string in an update function but on the PUT > request CouchDB tells me that "JSON is not defined". > My update function should do something like this (in the request body is > the JSON string): > > function(doc, req) { > if (!doc) { > if (req.docId) { > doc = { _id : req.docId} > }; > return [null, "error"]; > } > doc.properties = JSON.parse(req.body); > return [doc, "success"]; > } > > Apparently JSON is not available in SpiderMonkey. Anyone who knows how I > can still easily parse a JSON string? > > Thanks, > Mirko
