I am more or less convinced that it is possible to write my own code, inspecting the JSON and creating an object based on that.
But I am hoping that I have missed some part of the documentation, cause it would be nice to have a method such as ParseObject.create(JSON)
in Android.
The scenario is that I push changes in server data out to relevant clients. The push is send directly from Cloud Code in afterSave
.
Currently I just notify that a change has been made in a specific class, then the client reacts by fetching all the objects in that class and update the Local Datastore accordingly.
This is not very efficient so it would be nice to be able to simply send the updated object directly using the push and then pin it on the client. Completely avoiding the extra work from fetching and updating all the objects.
parse() The JSON. parse() method parses a JSON string, constructing the JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned.
How Does JSON Parse Work? The JSON parse function takes data that's in a text format and then converts it into JavaScript. Usually, these take the form of JavaScript objects, but the parse function can be used directly on arrays as well.
parseJSON() is used for parsing JSON text.
JSON is a data interchange format that is easy to parse and generate. JSON is an extension of the syntax used to describe object data in JavaScript. Yet, it's not restricted to use with JavaScript. It has a text format that uses object and array structures for the portable representation of data.
I know this question is quite old but I think there is a beginning of solution in this github thread: since the SDK is open source, we can see that they've a not-open method for that.
I had the same issue and I forked the SDK (and did a bit of git and Gradle! :) ) and it is working pretty well yet! (I wanted to send encrypted ParseObject from CloudCode).
And I had chance because someone did the job I wanted to do on this commit (ok that was not so much!) so it means that you can (kind of) trust the hack!
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With