Giedrius Šlikas

Pranav J

Can you send me the sample project where you are trying to parse Json array from Kinvey collection and facing issues?

Thanks,PranavKinvey

d

daniel livingstone

said
about 1 year ago

i am facing the same problem too, i can't parse json object returned to me from kinvey. Here are my smaples:

d

daniel livingstone

said
about 1 year ago

i was not sure the first code snippet uploaded well. Thanks alot

d

daniel livingstone

said
about 1 year ago

I have gone through the kinvey documentation a 101 times, in fact i'm using it step by step - its always open in my browser.

but it has not helped me for this issue, there is no reference there for this issue.

B

Billy Gee

said
about 1 year ago

Hello Daniel,

For the JSON returned by Kinvey, are you having the parsing problem when querying the backend using the Kinvey Console or in the "cafe" app itself?

If the Kinvey Console, can you send the query that you are using to retrieve the data and the snippet of code that is performing the JSON parsing?

If it is failing in the "cafe" app, what version of the SDK are you using. I can see that your using a Javascript SDK but I am unable to determine the exact version number that you are using in our logs.

Regards,

Billy Gee

d

daniel livingstone

said
about 1 year ago

Yes, the parsing problem is in the app itself (cafe) ant the version of kinvey-nativescript-sdk i am using is version: 3.9.4.

a snippet of my package.json is shown below.

Thanks alot and sorry for the late reply, #

new stuff.

Martin Apostolov

said
about 1 year ago

Hi Daniel,

Based on the provided code sample, the received "entities" is of type object, so you should not JSON.parse() it. The code would look like this:

daniel livingstone

said
about 1 year ago

Thanks a lot, i am really grateful.....I cant even express how much I am grateful and feel like someone's there for me. thanks.

I have another issue pls, i am trying to bind the retrieved data to my xml view but my view model is giving me headaches, it keeps on giving me this log: JS: Binding: Property: 'Numbers' is invalid or does not exist. SourceProperty: 'Numbers'

, could you pls look at the files for me? I would be very grateful....here are the files:

d

daniel livingstone

said
about 1 year ago

this is how the object returned looks like, but am trying to see how to bind this to the view using the view-model. thanks alot

Martin Apostolov

said
about 1 year ago

Hi Daniel,

Looking at the code snippets, and the error "Property: 'Numbers' is invalid or does not exist." it looks to me that the property "Numbers" is not an array as it is expected. You may create an empty array instead of just defining the variable to make sure the value is an array:

// create an empty array for the property value as the property value is being assigned to the testModel.Numbersletvalue= [];

Also, when you are adding objects to an observable array you should use the methods described here as otherwise you would be overwriting the observable array object with plain JavaScript object which would not notifies any subscribers (in this case the listView) when a change occurs.

This problem seems to be more related to NativeScript than Kinvey backend, so please note that for any NativeScript related issues it is best to seek NativeScript expertise on the community slack channel (nativescriptcommunity.slack.com) or in the community forum at discourse.nativescript.org.