question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hierarchical sort with JSON kind of loses the final closing braces

See original GitHub issue

If I get a chance I’ll try and submit a pull request for this.

Describe the bug When sorting JSON object properties with Hierarchical sort each element’s closing brace kind of comes adrift.

To Reproduce Steps to reproduce the behavior:

  1. Try sorting something like this ascending with the Heirachical sort…
      "X-Correlation-ID": {
        "$ref": "components/parameters/X-Correlation-ID.json"
      },
      "Authorization": {
        "$ref": "components/parameters/Authorization.json"
      },
  1. Results in…
      "Authorization": {
        "$ref": "components/parameters/Authorization.json"
      "X-Correlation-ID": {
        "$ref": "components/parameters/X-Correlation-ID.json"
      },
      },

Expected behavior We would expect this result…

      "Authorization": {
        "$ref": "components/parameters/Authorization.json"
      },
      "X-Correlation-ID": {
        "$ref": "components/parameters/X-Correlation-ID.json"
      },

Screenshots

image

image

Environment : IntelliJ IDEA 2020.3.1 (Ultimate Edition) Build #IU-203.6682.168, built on December 29, 2020 Licensed to REDACTED You have a perpetual fallback license for this version. Subscription is active until December 1, 2021. Runtime version: 11.0.9.1+11-b1145.63 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.15.7 GC: ParNew, ConcurrentMarkSweep Memory: 1979M Cores: 12 Registry: compiler.automake.allow.when.app.running=true Non-Bundled Plugins: com.intellij.ideolog, com.jetbrains.ChooseRuntime, com.intellij.plugins.watcher, com.jinsihou.react.snippets, com.ultrahob.zerolength.plugin, indent-rainbow.indent-rainbow, org.jetbrains.plugins.rest, mobi.hsz.idea.gitignore, AWSCloudFormation, org.zalando.intellij.swagger, String Manipulation, com.kaylerrenslow.plugin.armaplugin.id, org.jetbrains.plugins.hocon, com.jetbrains.lang.ejs, cucumber-javascript, intellij.prettierJS, com.dmarcotte.handlebars, com.intellij.react.css.modules, org.jetbrains.plugins.vue, tv.twelvetone.intellij.plugins.intellivue, org.jetbrains.kotlin, org.intellij.scala, com.jetbrains.php, com.jetbrains.twig, org.jetbrains.plugins.ruby, Pythonid, aws.toolkit, ru.adelf.idea.dotenv

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
krasacommented, Jan 20, 2021

Just right click on it image

0reactions
WillGibsoncommented, Jan 22, 2021

I made a failing test and I can see how this could be really tricky!

I had a look around specifically for sorting JSON and JSON Sorter exists and works well for the JSON use case, so no point reinventing the wheel 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sorting JSON object(s) into a Hierarchy - Stack Overflow
I need to sort out a JSON array into ...
Read more >
Consuming JSON Strings in SQL Server - Redgate Software
The first snag for TSQL is that the curly or square brackets are not 'escaped' within a string, so that there is no...
Read more >
39 JSON in Oracle Database
A JSON object is a JavaScript object literal. It is written as such a property list enclosed in braces ( { , }...
Read more >
Monaco Editor Monarch - Microsoft Open Source
Monarch: create declarative syntax highlighters using JSON. This document describes how to create a syntax highlighter using the Monarch library.
Read more >
Remove Square Brackets from JSON - SQL Server
To remove the square brackets that surround the JSON output of the FOR JSON clause by default, specify the WITHOUT_ARRAY_WRAPPER option.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found