Quantcast
Channel: Active questions tagged jq - Stack Overflow
Browsing all 657 articles
Browse latest View live
↧

Concat 2 fields in JSON using jq

I am using jq to reformat my JSON.JSON String:{"channel": "youtube", "profile_type": "video", "member_key": "hello"}Wanted output:{"channel" : "profile_type.youtube"}My command:echo '{"channel":...

View Article


CSV/PPrint output/conversion from json via the command line (linux)

I'd like to get a csv/prettyprint output from the following json.{"count": 28,"data": [ {"id": 100920,"name": "bam","_embedded": {"addresses": [ {"address": "10.244.134.115" } ] } }, {"id":...

View Article


Make jq output an escaped sequence [duplicate]

I can't seem to get jq to escape a TAB character for me properly. This is a json I'm working with:{"api01": {"before": {"path": "api01","user": "admin" } },"server01": {"before": {"path":...

View Article

JQ return exit boolean instead of exit status code

I have following scriptgrep -e . testFile |jq -e ".fundingMoved.\"com.test\".map.\"java.util.HashMap\" |if .TRANSACTION_DESTINATION? then(.AGREEMENT_OWNING_ORG | startswith(\"MXN\")) and...

View Article

How to increase depth limit of jq?

When trying to minify a deeply nested JSON file (~10k deep) using jq I got a parse error:$ jq -c . <input.json >minified.jsonparse error: Exceeds depth limit for parsing at line 227263, column...

View Article


Invalid numeric literal when running jq from script via crontab

I have a shell script that runs fine from the command line but throws a error when it's run from a cronjob. What could be causing this error?The following includes the cron, the script, and the error...

View Article

How to merge 2 JSON objects from 2 files using jq?

I'm using the jq tools (jq-json-processor) in shell script to parse json.I've got 2 json files and want to merge them into one unique fileHere the content of files:file1{"value1": 200,"timestamp":...

View Article

Convert sequence of JSON lines (JSONL) to JSON array

I have a file where each line is a JSON object. I'd like to convert the file to a JSON array.The file looks something like this:{"address":"email1@foo.bar.com", "topic":"Some...

View Article


How to check if element exists in array with jq

I have an array and I need to check if elements exists in that array or to get that element from the array using jq, fruit.json:{"fruit": ["apple", "orange","pomegranate","apricot","mango" ]}cat...

View Article


JQ how to print newline and not newline character from json value

I have some logs that output information in JSON. This is for collection to elasticsearch.Some testers and operations people want to be able to read logs on the servers.Here is some example...

View Article

Select object from list where value is elsewhere in the JSON

Let's say I have a bit of JSON that looks like this{"fish": [ {"name": "pike","version": 1 }, {"name": "haddock","version": 2 } ],"current_fish_version": 2}And I wanted to get the name of the fish with...

View Article

Using jq to parse and display multiple fields in a json serially

I have this Json{"users": [ {"first": "Stevie","last": "Wonder" }, {"first": "Michael","last": "Jackson" } ]}Using jq I'd like to display first and last name serially. Like so -Stevie WonderMichael...

View Article

Replace \n with space in jq query/command output without tr and sed commands

With input.json:{"server1": {"name": "server1","property": "ENABLED" },"server2": {"name": "server2","property": "ENABLED" },"server3": {"name": "server3","property": "ENABLED" },}The following jq...

View Article


Printing multiple values on the same line

I'm trying to parse a JSON document and print a couple of values on the same line. Is there a way to take this document:{"fmep": {"foo": 112,"bar": 234324,"cat": 21343423 }}And print:112 234324I get...

View Article

jq: error (at :1): Cannot index string with string "prerelease" [closed]

full error explanation>The script tries to download https://api.github.com/repos/openapitools/openapi-generator/releases and parse the latest version, but the download sometimes can fail and the...

View Article


Convert key = value pairs to JSON

I am trying to convert a file containing key = value pairs into JSON.This file might contain Windows EOL (\r\n) and empty lines.Given the following input (mind the empty lines):foo = aabar = bbqux =...

View Article

Using jq with Jenkins pipeline

In my use case i'm running a pipeline which calls aws cli via the withAWS plugin. I use jq to get the needed data, Now the sh returns the output as String. How do i convert this output to json object...

View Article


How to merge and aggregate values in 2 JSON files using jq?

I am using jq in a shell script to manipulate JSON files.I have 2 files and I'd like to merge them into one file while also aggregating (sum) the values when names in the name/value pairs are the...

View Article

debugging break error in jq JOIN function

I'm trying to get more information on an error in jq.I have two files, let's call them file1.json and file2.json, both of which contain an array of objects that I want to join by a common property,...

View Article

Using zsh and ace to pull metadata from epub using recursion [duplicate]

I'm trying to pull a bunch of metadata from a bunch of epubs. I'm on a Mac, using Ace by Daisy.So far I have:#!/bin/zshif [[ -e ./report.txt ]]; then rm ./report.txtfititles=("ISBN"...

View Article
Browsing all 657 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>