1

I'm trying to sort following json that is inside of terraform file. I'd like to sort it alphabetically by "name" value (ENV->PORT->USERNAME):

      {
        "name": "PORT",
        "value": sometimes_there_is_no_quotation_mark
      },
      {
        "name": "ENV",
        "value": "${var.env}"
      },
      {
        "name": "USERNAME",
        "value": "${var.username}"
      }

I've been trying jq json.tool and SortGroup function but unfortunately none of them works for me.

  • 1
    Since you have jq there's no reason to use Vim to address your issue. If you're a Unix/Linux user you can ask about jq at the associated site. Otherwise SuperUser, I suppose. – B Layer Aug 5 '19 at 16:26
  • I'd prefer some some nice vim module, or sleek way of sorting this out in vim ... That's why I've asked here. – a_z Aug 5 '19 at 16:48
  • 1
    You can look this screencast which shows you how you can achieve what you want with macros and such. – perelo Aug 5 '19 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.