Closed EliteMasterEric closed 1 year ago
I didn't reproduce with your example.
Could you tell which version of json2object you are using and if possible provide a more complete example ?
This could come from your dynamicValue function if it also use json2object for the parsing.
I will produce a more complete test bench, hold on.
EDIT: I get the same error on this repo: https://github.com/EliteMasterEric/json2object-dynamic
Thanks for the code, I would probably never found the issue otherwise.
For some reason the type of the Dynamic field changes when it has an initial value.
With the latest commit, it should work for you.
Oh yeah this is fixed.
I'm looking to parse a JSON string, for which one value is a JSON object which can contain any values. I was intending on parsing that object later based on the value of another property.
However, when I try to do this, I get an error:
This occurs even when I do the following:
My expectation here is that the error would be skipped over because a parser has been provided.
I would also expect that, in the general case,
Dynamic
would just have the parser insert the value without validating types (so ifv
is a String, just setvalue
to the String, and if it's an object, set it to an anonymous structure like the output ofhaxe.Json
.