Skip to content

Instantly share code, notes, and snippets.

@theraccoonbear
Created June 11, 2021 18:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theraccoonbear/148fe6c90ecb88bff75beb9d4b34eec0 to your computer and use it in GitHub Desktop.
Save theraccoonbear/148fe6c90ecb88bff75beb9d4b34eec0 to your computer and use it in GitHub Desktop.

Convert the giant blob of invalid JSON Robo3T gives you into something consumable.

  • First:
    • Find... (?:ISODate|ObjectId)\(("[^"]+")\) (BSON types)
    • And replace with... $1 (the non-ignored capture group)
  • Second:
    • Find... (/\*\s+\d+\s+\*/) (index comments)
    • And replace with... , (comma to separate array elements)
  • Finally
    • Remove the stray comma where /* 1 */ used to be
    • Wrap everything in [...] so it's now an array of objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment