Closed mltsy closed 7 years ago
I don't think json
and jsonString
are very good names for this - int
returns decodes into an Int
, string
decodes into a String
, json
decodes json into something else entirely. Perhaps doubleEncoded
is the better choice here, indeed.
I'll merge this and add some doc-tests :)
Ah, sure, that makes sense from that perspective. I guess list and dict also decode into the corresponding types, rather than naming a kind of data in the json context (such as object or array). :+1:
This decoder decodes a string field that contains a JSON-encoded string.
As outlined by @jamesmacaulay for me (thanks!) :+1:
We could alternately call this
json
orjsonString
to indicate that the field contains JSON, which would be more consistent with other built-in decoders (string
,int
,list
, etc.), butdoubleEncoded
seems nicely explicit in a context where everything is supposed to be JSON. I'm not sure which is clearer.Also, I'm not sure if I got the documentation format right (I'm not familiar with it, so I just copied the format I saw on other methods)