You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issue with new model instance and JSON encoded values #168
Upon creation unless the created object's field contains a JSON string it will be null. It will always be a string from the database, but in a situation where I am creating the object it does not always make sense. I think that both cases below should work.
// Currently not possible, config will be nullnewGraphNode({node_id: 0working_dir: "/some/directory",config: {a_field: "some value"}});// As opposed tonewGraphNode({node_id: 0working_dir: "/some/directory",config: '{"a_field": "some value"}'});// ...
The instance is stored in object notation when it is initialized in the first place. In my case the objects I am parsing are already JSON strings that are parsed to create the model instances. It seems a bit silly to parse the JSON, re-stringify parts of the model instance, and decode them again when the instances are created. This solution provides a means by which you can supply a raw object (or array) which is still valid JSON.
Activity
Tape commentedon May 20, 2013
The instance is stored in object notation when it is initialized in the first place. In my case the objects I am parsing are already JSON strings that are parsed to create the model instances. It seems a bit silly to parse the JSON, re-stringify parts of the model instance, and decode them again when the instances are created. This solution provides a means by which you can supply a raw object (or array) which is still valid JSON.
dresende commentedon May 28, 2013
The
Objectproperty type should handle this correctly. If it's not it's a bug and it has to be fixed. I'll look at it.dresende commentedon May 28, 2013
I found the bug, at least in mysql this happens too. I'm going to change in the other drivers.
Avoids JSON parsing values when they are already objects (and not str…
dresende commentedon May 28, 2013
Please test this last commit :)
dresende commentedon May 31, 2013
This should be ok now, reopen if the problem persists.