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
if the type implements json.Marshaler, call MarshalJSON, convert result to json.RawMessage and then browse into that (requires Get() inside json.RawMessage #2)
else follow encoding/json mapping rules using struct tags to map the struct as if it was a map[string]interface{} (an easy (but inefficient) solution could call json.Marshal() and then follow Get() inside json.RawMessage #2)
The text was updated successfully, but these errors were encountered:
Finally got around to considering using a new package for my json pointer needs.
Now, what I'd like to do is to apply JSON pointer semantics to a struct, namely a JSON Schema object.
I want the JSON Schema object to NOT have to be a map[string]interface{}, and I don't want to the object to have to be directly JSON-marshal-able (i.e. it has a MarshalJSON() method, but the struct definition itself is not a one-to-one mapping to the resulting JSON structure)
I think this issue means "marshal the object to JSON, then apply the logic implemented by jsonptr". Just as a thought, to avoid having to convert the struct into JSON just for this operation, would it make sense to define a type JSONGetter interface { Get(path) (interface{}, error) } or some such, to further delegate the resolution of the JSON pointer to the object itself?
Implement
Get()
traversing into struct{} as requested by @lestrrat:json.Marshaler
, callMarshalJSON
, convert result tojson.RawMessage
and then browse into that (requires Get() inside json.RawMessage #2)encoding/json
mapping rules using struct tags to map the struct as if it was amap[string]interface{}
(an easy (but inefficient) solution could calljson.Marshal()
and then follow Get() inside json.RawMessage #2)The text was updated successfully, but these errors were encountered: