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
In order to leverage haxe class parsing you must have the "_hxcls" property set as the first entry, and this is an unintuitive requirement (and very restricting).
{"float":0.5,"_hxcls":"test.ClassTest"}
should work the same as {"_hxcls":"test.ClassTest","float":0.5}
If I can find the time I shall add it in, however: any parser operations should be checked for first before parsing other fields.
The text was updated successfully, but these errors were encountered:
The serializer should always include the _hxcls property first, so in the use case of parsing json that was serialized with the TJSON serializer this should not be an issue.
Checking the entire string for the existence of a _hxcls property would require a 2-pass parsing approach that would unfortunately hurt performance. I'm not sure if the benefit would outweigh the cost.
In what use case are you finding the need to have _hxcls property not be the first property?
The use case is having a spreadsheet with game data (potentially multiple people editing it, increasing possibility of human error) which is exported to a JSON file. In addition, it is easy to have occurrences of bugs with any data that you are loading that could not be serialized by TJSON initially (since any fields before that value stay at their default values). Lastly, there is no error reporting when it isn't first so it's a pretty silent failure.
Instead of doing 2 passes on the parsing, perhaps it'd be better to check that if this is not the first object property assigned then to re-assign the properties within this object that came before "_hxcls", sure it's less performant but it doesn't fail -- and can allow for data optimization later.
However, you make a good point with performance since this feature really depends on the needed implementation; I'll probably just fork off since this is more of an issue with my specific situation.
In order to leverage haxe class parsing you must have the "_hxcls" property set as the first entry, and this is an unintuitive requirement (and very restricting).
{"float":0.5,"_hxcls":"test.ClassTest"}
should work the same as
{"_hxcls":"test.ClassTest","float":0.5}
If I can find the time I shall add it in, however: any parser operations should be checked for first before parsing other fields.
The text was updated successfully, but these errors were encountered: