POSTing JSON data but need to manipulate data

POSTing JSON data but need to manipulate data

dshorthousedshorthouse Posts: 1Questions: 1Answers: 0

I am using CouchDB 2.1 and am trying to make use its built-in _find. This requires that I POST JSON data and so my ajax.data object is a function to return JSON.stringify. However, I also have a need to manipulate the data object just before POST using the preXhr.dt event. But, because the data object is now a string, I cannot manipulate it. Any suggestions?

Answers

  • colincolin Posts: 875Questions: 0Answers: 168

    Hi @dshorthouse ,

    Can't you just cast it back to a JSON structure with JSON.parse(), do your manipulating, and then reconvert with JSON.stringify() again?

    Cheers,

    Colin

Sign In or Register to comment.