• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Using ERRest to output JSON without quotes around a property value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using ERRest to output JSON without quotes around a property value


  • Subject: Using ERRest to output JSON without quotes around a property value
  • From: Ricardo Parada <email@hidden>
  • Date: Thu, 06 Jun 2013 13:52:40 -0400


Hi all,

Here is the simple explanation to my problem.  Instead of this:

{ "foo" : "value" }

I need the value for foo to be output as follows:

{ "foo" : value }

Notice, there are no quotes around value.  The reason I need this is because I am trying to generate JSON compatible with the mongo json parser to parse the JSON output and save it to a mongo database ().  The mongo JSON parser expects dates in a very unusual format.  So I wrote a MongoTimestampFormatter to output and parse dates in this unusual mongo-specific date format. 

For example, instead of this:

{ "foo" =  "2013-05-21T20:07:46Z" }

I need this:

{ "foo" =  { $date: "2013-05-21T20:07:46Z" }  }

The foo attribute is an NSTimestamp.  However, the output from ERRest after using my MongoTimestampFormatter comes out as follows since ERRest puts quotes around the value and escapes any double quote characters in the middle:

{ "foo" =  "{$date: \"2013-05-21T20:07:46Z\"}"  }

Is there an easy solution to this problem?

Thank you

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: wolips.properties hardcoded in build.xml
  • Next by Date: malformed bundle version number in deployment with Java 1.6
  • Previous by thread: Re: patch for wonders NSArray implementation
  • Next by thread: malformed bundle version number in deployment with Java 1.6
  • Index(es):
    • Date
    • Thread