Hi, I am not super familiar with parsing JSON data. I have been able to use .GetString and .GetData, however I have recently created a list of data in GameSparks and am having trouble retrieving it in Unity.
I am tired and going to bed. I imagine this is an easy solution that I will be able to figure out tomorrow, however if anyone knows how to access this data, and is willing to explain, you would make my morning =).
Thanks, Ian.
Best Answer
C
Chase Wilksch
said
about 4 years ago
Hey Ian,
As subscribed is another object, you would need to use .GetGSData again.
This would retrieve the object so that you can access its children using .getString("expirationData"), etc.
Still having trouble with this. How do I reference nested data? I can .getString() for data that is on the root of the GSObject but cannot seem to access the data that is nested.
I can access the spiritGuidesMeditation and shamanJourney with .getString() but when I try to access expirationDate and device by using .getStringList("subscribed") I get null...
b
barudy diego
said
about 4 years ago
Hi,
Can you copy/past all of your cloud code please?
Do you have a null on response.ScripData.GetString("_id") ?
I think that you forgot to set your scriptData in your cloud code...
Ian Robinson
Hi, I am not super familiar with parsing JSON data. I have been able to use .GetString and .GetData, however I have recently created a list of data in GameSparks and am having trouble retrieving it in Unity.
My data is saved with this Cloud Code:
The Data looks like this in the Data explorer:
When I try to access the data in Unity with these two attempts, I am getting null.
I am tired and going to bed. I imagine this is an easy solution that I will be able to figure out tomorrow, however if anyone knows how to access this data, and is willing to explain, you would make my morning =).
Thanks, Ian.
Hey Ian,
As subscribed is another object, you would need to use .GetGSData again.
This would retrieve the object so that you can access its children using .getString("expirationData"), etc.
.getStringList would need to be retrieving an array of string, .getGSDataList would need to retrieve an array of objects.
Hope this helps.
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstIan Robinson
Still having trouble with this. How do I reference nested data? I can .getString() for data that is on the root of the GSObject but cannot seem to access the data that is nested.
I can access the spiritGuidesMeditation and shamanJourney with .getString() but when I try to access expirationDate and device by using .getStringList("subscribed") I get null...
barudy diego
Chase Wilksch
Hey Ian,
As subscribed is another object, you would need to use .GetGSData again.
This would retrieve the object so that you can access its children using .getString("expirationData"), etc.
.getStringList would need to be retrieving an array of string, .getGSDataList would need to retrieve an array of objects.
Hope this helps.
1 person likes this
Ian Robinson
@Chase Wilksch
Christ I feel dumb, that makes perfect sense. Thank you Chase, this worked.
Thanks for the replies Chase and barudy! I appreciate your time.
Ian
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics