Pretty print of MQL/JSON code

Still its not so good the print : (

But its better than online tools i found so far

Online tool gave 250 lines,mongosh gave 170 lines,Clojure pprint 63 lines.
The query using Clojure pprint as Clojure map is still much better
(but it doesnt have : and , so its not valid json)

Clojure pprint

{"update" "testcoll",
 "updates"
 [{"q" {"UserId" 1},
   "u"
   [{"$addFields"
     {"Books"
      {"$let"
       {"vars"
        {"newBook" {"Name" "xxx2", "Auth" "xxx2", "Category" 2}},
        "in"
        {"$cond"
         [{"$not" [{"$ne" [{"$type" "$Books"} "missing"]}]}
          [{"Category" "$$newBook.Category",
            "BookInfos"
            [{"Name" "$$newBook.Name", "Auth" "$$newBook.Auth"}]}]
          {"$arrayElemAt"
           [{"$reduce"
             {"input" "$Books",
              "initialValue" [[] 0 false],
              "in"
              {"$let"
               {"vars" {"booksIndexAdded" "$$value", "book" "$$this"},
                "in"
                {"$let"
                 {"vars"
                  {"books" {"$arrayElemAt" ["$$booksIndexAdded" 0]},
                   "index" {"$arrayElemAt" ["$$booksIndexAdded" 1]},
                   "added" {"$arrayElemAt" ["$$booksIndexAdded" 2]}},
                  "in"
                  {"$cond"
                   [{"$eq" ["$$book.Category" "$$newBook.Category"]}
                    [{"$concatArrays"
                      ["$$books"
                       [{"$mergeObjects"
                         ["$$book"
                          {"BookInfos"
                           {"$concatArrays"
                            ["$$book.BookInfos"
                             [{"Name" "$$newBook.Name",
                               "Auth" "$$newBook.Auth"}]]}}]}]]}
                     {"$add" ["$$index" 1]}
                     true]
                    {"$cond"
                     [{"$and"
                       [{"$eq"
                         ["$$index"
                          {"$subtract" [{"$size" "$Books"} 1]}]}
                        {"$not" ["$$added"]}]}
                      [{"$concatArrays"
                        ["$$books"
                         ["$$book"
                          {"Category" "$$newBook.Category",
                           "BookInfos"
                           [{"Name" "$$newBook.Name",
                             "Auth" "$$newBook.Auth"}]}]]}
                       {"$add" ["$$index" 1]}
                       true]
                      [{"$concatArrays" ["$$books" ["$$book"]]}
                       {"$add" ["$$index" 1]}
                       "$$added"]]}]}}}}}}}
            0]}]}}}}}],
   "upsert" true,
   "multi" true}]}

Mongosh same query,with : and commas, but some keys are not strings,so still not valid json

{
  update: 'testcoll',
  updates: [
    {
      q: { UserId: 1 },
      u: [
        {
          '$addFields': {
            Books: {
              '$let': {
                vars: {
                  newBook: { Name: 'xxx2', Auth: 'xxx2', Category: 2 }
                },
                in: {
                  '$cond': [
                    {
                      '$not': [
                        { '$ne': [ { '$type': '$Books' }, 'missing' ] }
                      ]
                    },
                    [
                      {
                        Category: '$$newBook.Category',
                        BookInfos: [
                          {
                            Name: '$$newBook.Name',
                            Auth: '$$newBook.Auth'
                          }
                        ]
                      }
                    ],
                    {
                      '$arrayElemAt': [
                        {
                          '$reduce': {
                            input: '$Books',
                            initialValue: [ [], 0, false ],
                            in: {
                              '$let': {
                                vars: {
                                  booksIndexAdded: '$$value',
                                  book: '$$this'
                                },
                                in: {
                                  '$let': {
                                    vars: {
                                      books: {
                                        '$arrayElemAt': [ '$$booksIndexAdded', 0 ]
                                      },
                                      index: {
                                        '$arrayElemAt': [ '$$booksIndexAdded', 1 ]
                                      },
                                      added: {
                                        '$arrayElemAt': [ '$$booksIndexAdded', 2 ]
                                      }
                                    },
                                    in: {
                                      '$cond': [
                                        {
                                          '$eq': [
                                            '$$book.Category',
                                            '$$newBook.Category'
                                          ]
                                        },
                                        [
                                          {
                                            '$concatArrays': [
                                              '$$books',
                                              [
                                                {
                                                  '$mergeObjects': [
                                                    '$$book',
                                                    {
                                                      BookInfos: {
                                                        '$concatArrays': [
                                                          '$$book.BookInfos',
                                                          [
                                                            {
                                                              Name: '$$newBook.Name',
                                                              Auth: '$$newBook.Auth'
                                                            }
                                                          ]
                                                        ]
                                                      }
                                                    }
                                                  ]
                                                }
                                              ]
                                            ]
                                          },
                                          { '$add': [ '$$index', 1 ] },
                                          true
                                        ],
                                        {
                                          '$cond': [
                                            {
                                              '$and': [
                                                {
                                                  '$eq': [
                                                    '$$index',
                                                    {
                                                      '$subtract': [
                                                        {
                                                          '$size': '$Books'
                                                        },
                                                        1
                                                      ]
                                                    }
                                                  ]
                                                },
                                                {
                                                  '$not': [ '$$added' ]
                                                }
                                              ]
                                            },
                                            [
                                              {
                                                '$concatArrays': [
                                                  '$$books',
                                                  [
                                                    '$$book',
                                                    {
                                                      Category: '$$newBook.Category',
                                                      BookInfos: [
                                                        {
                                                          Name: '$$newBook.Name',
                                                          Auth: '$$newBook.Auth'
                                                        }
                                                      ]
                                                    }
                                                  ]
                                                ]
                                              },
                                              {
                                                '$add': [ '$$index', 1 ]
                                              },
                                              true
                                            ],
                                            [
                                              {
                                                '$concatArrays': [
                                                  '$$books',
                                                  [ '$$book' ]
                                                ]
                                              },
                                              {
                                                '$add': [ '$$index', 1 ]
                                              },
                                              '$$added'
                                            ]
                                          ]
                                        }
                                      ]
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        0
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      ],
      upsert: true,
      multi: true
    }
  ]
}

I would like something like Clojure pprint with valid JSON
if someone finds a tool to do this it would be nice to use it,to send compact JSON.
It could help the forum also