Member-only story

Troubleshooting a Linux/Unix/Mac error ‘jq: error: May need parentheses around object key expression at <top-level>, line 1:’

--

Here is another interesting error I encountered while working to create a newly customized JSON file with jq command. jq command, as some of you may know, is an Unix that can run in Linux/UNIX/MacOS that can help to create, to edit, and to play with JSON (Javascript Object Notation) files.

JQ command

Anyway, I was getting a following error while trying to create a JSON file.

jq: error: May need parentheses around object key expression at <top-level>, line 1:

Error while creating a JSON file with JQ

What is happening is that a variable based key, which is $version in this case, needs to be wrapped around in parentheses. Thus, it will be like this:

After a fix

That was it! Although it looks quite simple, I know it can come in handy sometime :)

--

--

Bryant Jimin Son
Bryant Jimin Son

Written by Bryant Jimin Son

A cloud practitioner talking about technology, travels & career tips. But I will sometimes cover financial advises and some random stuffs.

No responses yet