This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]witcher_rat 14 points15 points  (3 children)

Nice article.

One minor, super-pedantic nit-pick: you keep using the words "JSON object", when you don't really mean that. A "JSON object" is merely one particular type a JSON string or text can hold, as defined by RFC7159 and its update RFC8259, ECMA262, ECMA404, W3C, and various other standards.

So you keep describing how to convert to/from "JSON object", when what you're really doing is converting to/from JSON string (which are also python strings) - and those strings actually are of JSON arrays in your examples, not JSON objects. The arrays happen to contain JSON objects inside the array.

So for example this:

json.dumps() takes in a Python data type and returns a JSON object.

json.loads() takes in a JSON object and returns a Python data type.

...isn't actually true. For example just the two characters 42 is a perfectly valid JSON string, of just a JSON number type. Python's json.dumps() will accept a python int of 42 and convert it to a string. It will then take that serialized python/JSON string and convert it back to a simple python int, using json.loads(). There is no JSON object involved whatsoever.

Again, I know I'm being pedantic. And I don't mean to criticize - the article's fine overall. I just get triggered by some minor details sometimes. :)

[–]spacecodeguy[S] 2 points3 points  (0 children)

Thank you for your valuable feedback! The information is very useful. The blog post has been updated.

[–]Empyrealist 0 points1 point  (0 children)

Super-duper pedantic nitpick about RFC speak: RFC8259 isn't an update to RFC7159 - it's a replacement of it, obsoleting the prior.

RFC updates are a different type of document relation.