Getting Data From a Repeat Group

When i try to get data from a repeat group, instead of returning an array,
if it’s one object it returns a single object instead of an array, for
multiple objects it returns an array.

I think it should return an array in both cases in order to allow parsing
of these objects.

Hi Hikesh,

Can you clarify what you are referring to when you say “get data”.

Unfortunately our JSON format doesn’t know at submission-time whether
something is a repeat group or a regular group, which is why this behavior
exists. I believe you should be able to use commcare export
https://confluence.dimagi.com/display/commcarepublic/CommCare+Data+Export+Tool
to normalize the data if you are using the APis.

thanks,
Cory

··· On Mon, Dec 21, 2015 at 12:53 AM, Hikesh Hasmukh wrote:

When i try to get data from a repeat group, instead of returning an array,
if it’s one object it returns a single object instead of an array, for
multiple objects it returns an array.

I think it should return an array in both cases in order to allow parsing
of these objects.


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Cory

We are using data forwarding, when there is a change or submission, data is
forwarded to our web application and we use the CommCare API to parse the
Json. In my perception, the data from a repeat group should be always in an
array.
We are building a parser for the json, and we need to know what kind of
data to parse.

··· On Monday, December 21, 2015 at 8:33:40 PM UTC+2, Cory Zue wrote: > > Hi Hikesh, > > Can you clarify what you are referring to when you say "get data". > > Unfortunately our JSON format doesn't know at submission-time whether > something is a repeat group or a regular group, which is why this behavior > exists. I believe you should be able to use commcare export > > to normalize the data if you are using the APis. > > thanks, > Cory > > On Mon, Dec 21, 2015 at 12:53 AM, Hikesh Hasmukh <hikesh....@gmail.com > wrote: > >> When i try to get data from a repeat group, instead of returning an >> array, if it's one object it returns a single object instead of an array, >> for multiple objects it returns an array. >> >> I think it should return an array in both cases in order to allow parsing >> of these objects. >> >> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "CommCare Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to commcare-developers+unsubscribe@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

Hi Hikesh,

Understood. Yes, this is not possible to change right now due to the way
that our XML to JSON parsing works. I’d recommend having your endpoint
accommodate either the list or dict format.

thanks,
Cory

··· On Wed, Dec 23, 2015 at 1:26 AM, Hikesh Hasmukh wrote:

Hi Cory

We are using data forwarding, when there is a change or submission, data
is forwarded to our web application and we use the CommCare API to parse
the Json. In my perception, the data from a repeat group should be always
in an array.
We are building a parser for the json, and we need to know what kind of
data to parse.

On Monday, December 21, 2015 at 8:33:40 PM UTC+2, Cory Zue wrote:

Hi Hikesh,

Can you clarify what you are referring to when you say “get data”.

Unfortunately our JSON format doesn’t know at submission-time whether
something is a repeat group or a regular group, which is why this behavior
exists. I believe you should be able to use commcare export
https://confluence.dimagi.com/display/commcarepublic/CommCare+Data+Export+Tool
to normalize the data if you are using the APis.

thanks,
Cory

On Mon, Dec 21, 2015 at 12:53 AM, Hikesh Hasmukh hikesh....@gmail.com wrote:

When i try to get data from a repeat group, instead of returning an
array, if it’s one object it returns a single object instead of an array,
for multiple objects it returns an array.

I think it should return an array in both cases in order to allow
parsing of these objects.


You received this message because you are subscribed to the Google
Groups “CommCare Developers” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.