incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mirko Kiefer <mirko.kie...@arcor.de>
Subject parsing JSON in update function
Date Thu, 04 Mar 2010 23:44:44 GMT
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
Mime
View raw message