News for hackers. Stuff that matters.
Re:The Pretty JSON Revolution by msluyter on Tuesday February 23, 2021 @11:29AM (#26239198)
In theory, order shouldn't matter, right? But I recall seeing this trick for adding comments to json:

  { 
    "foo": "this is a comment about foo",
    "foo": "actual value of foo that overwrites the comment"
  }
The trick is that the second value value of foo overwrites the first. But, clearly, sorting would would wreak havoc here (if the value was used in the sort key). ;)
Re:The Pretty JSON Revolution by Buttons840 on Tuesday February 23, 2021 @12:39PM (#26240205)
Yes. That is valid JSON.

A fun fact about MongoDB is it will actually store that JSON, both duplicate keys. The implication is that whatever MongoDB client you're using, that maps Mongo data to dictionaries/maps, is not capable of representing all valid MongoDB documents. It's important to recognize that Mongo may be storing data your client will not be able to access.

I learned this when the Python client was showing one value for a key, and the Ruby client was showing another value for the same key, and neither client was showing the whole document.

Re:The Pretty JSON Revolution by jd_mongodb on Wednesday February 24, 2021 @08:37AM (#26249674)
I can't reproduce that behaviour on MongoDB 4.2.x using Python and the Shell client.
Re:The Pretty JSON Revolution by Buttons840 on Wednesday February 24, 2021 @04:10PM (#26255994)
It was the case some years ago. I'm not sure if it still is the case.