ERRest - problem outputting xml as JSON object

2011-07-15 Thread Elizabeth Lynch
I am building an ERRest application (read only), and am having a problem with one field. This field holds an xml string, which I need to embed into the output from show and index actions; it will be consumed as json (mainly; possibly only). For example, I would like to receive: {name : A

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Pascal Robert
I think the best way would be to transform the XML to a Java object and transform that object back to JSON. I am building an ERRest application (read only), and am having a problem with one field. This field holds an xml string, which I need to embed into the output from show and index

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Elizabeth Lynch
Hi Pascal Sorry, I didn't explain the problem clearly. I am doing that already. The problem is that it comes as a string in my JSON output, not as an object. Liz Sent from my iPhone On 15 Jul 2011, at 12:39, Pascal Robert prob...@macti.ca wrote: I think the best way would be to transform

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Maik Musall
Hi Liz, already tried org.json.XML? That's what I use for similar tasks. http://www.JSON.org/java/index.html Maik Am 15.07.2011 um 14:58 schrieb Elizabeth Lynch: Hi Pascal Sorry, I didn't explain the problem clearly. I am doing that already. The problem is that it comes as a string in

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Farrukh Ijaz
Hi Liz, That's a common issue. Suppose you receive the JSON mentioned below, once you get the value of data attribute which is a JSON object in string format, evaluate it using eval() method of javascript and it will be converted to JSON. Farrukh Sent from my iPad 2 On 2011-07-15, at 3:58

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Elizabeth Lynch
Hi Farrukh Thanks: that's a good suggestion, but I need to get it into JSON before it leaves the server, so that technique won't work for me. Liz On 15 Jul 2011, at 15:55, Farrukh Ijaz wrote: Hi Liz, That's a common issue. Suppose you receive the JSON mentioned below, once you get the

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Farrukh Ijaz
I think you can define an additional getter method over data as dataDictionary() which should return the data xml as NSDictionary. This will solve the problem for both XML and JSON. Farrukh On 2011-07-15, at 7:24 PM, Elizabeth Lynch wrote: Hi Farrukh Thanks: that's a good suggestion, but

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Elizabeth Lynch
Hi I think you can define an additional getter method over data as dataDictionary() which should return the data xml as NSDictionary. This will solve the problem for both XML and JSON. Unfortunately that isn't working for me. Here's some more information I've discovered about the ERREST

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Mike Schrag
That should work. What key filter are you using? Are you not allowing keys in from the nested dictionary? On Jul 15, 2011, at 1:43 PM, Elizabeth Lynch wrote: Hi I think you can define an additional getter method over data as dataDictionary() which should return the data xml as

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Elizabeth Lynch
Hi That should work. What key filter are you using? Are you not allowing keys in from the nested dictionary? Here is my implementation of data for testing (from Category.java): public NSDictionary data() { return new NSDictionary(key, stringValue); } and my

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Farrukh Ijaz
Use ERXKeyFilter.filterWithAll() or ERXKeyFilter.filterWithAllRecrusive() Farrukh On 2011-07-15, at 11:12 PM, Elizabeth Lynch wrote: Hi That should work. What key filter are you using? Are you not allowing keys in from the nested dictionary? Here is my implementation of data for

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Farrukh Ijaz
Below is a the running sample with filterWithAttributes and filterWithAllRecursive() public WOActionResults testAction() throws Throwable { ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes(); NSMutableDictionaryString, Object dict = new NSMutableDictionaryString,

Re: ERRest - problem outputting xml as JSON object

2011-07-15 Thread Elizabeth Lynch
Hi Farrukh filterWithAllRecursive works great. Thanks for the help everyone. Liz On 15 Jul 2011, at 21:37, Farrukh Ijaz wrote: Use ERXKeyFilter.filterWithAll() or ERXKeyFilter.filterWithAllRecrusive() Farrukh On 2011-07-15, at 11:12 PM, Elizabeth Lynch wrote: Hi That should work.