PDA

View Full Version : JasonP reader: I am able to read, but I don't know how to do with template



power651113
3 Nov 2013, 12:20 PM
Hi,

I am able to get this data from JasonP reader. However I have an issue on mapping this data to fetch my model. In this case, do I have to set root as ChatterFeedInfo? When I set the root as ChatterFeedInfo, it comes 12 record. In fact, I only have 8 records. What is the proper way to set the mapping and use on the tpl? Try to get rid of "\", but I have no idea to get rid of that

Models has

Body, CreatedBy_Name, CreatedDate, ParentID

This is url content that I set on the reader.
callback({"ChatterFeedInfo":"[{\"Body\":\"Hi this is...test\",\"CreatedBy_Name\":\"Adam\",\"CreatedDate\":\"2013-09-13 - 08:39:27\",\"ParentID\":\"001K000000fGS6SIAW\"})


Thanks,
Adam

power651113
4 Nov 2013, 1:39 PM
I know I have to put "ChatterFeedInfo" as my root. For the field mapping at model, I try 'Body\' and the other format. But all are not working. Please advice. Thank you

skirtle
5 Nov 2013, 6:54 AM
Your JSON-P is wrong, the ChatterFeedInfo has been encoded as a string. It should be like this:


callback({"ChatterFeedInfo":[{"Body":"Hi this is...test","CreatedBy_Name":"Adam","CreatedDate":"2013-09-13 - 08:39:27","ParentID":"001K000000fGS6SIAW"}]})

You touch on this in your original question but there's no way around it, you need to fix your server.

power651113
5 Nov 2013, 12:44 PM
Yes, you are right. My server response issue is fixed. I am able to read this data by JsonPreader.

Thank you.