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

Parse error when text is split on multi lines: "control characters from...

I'm getting a "parse error" when I split a text line on multiple lines and show the JSON file on screen with the command jq . words.json.The JSON file with the text value on a single line looks like...

View Article


How can I put integer as an argument in jq?

I have been trying to use jq to parse a json file returned from the aws cli, but I'm stuck with the problem of referencing an array using the index number. I need to do this because I want to export a...

View Article


How to check for presence of 'key' in jq before iterating over the values

I get Cannot iterate over null (null) from the below query because .property_history is not present in result object.How do I check for the presence of .property_history key before proceeding with...

View Article

Comparing two json files : shell scripting

I'm comparing two json files which look like:[ {"type" : 1,"children" : {"nsubj" : {"role" : "topic","POS" : ["noun" ] } },"role" : "vehicle","POS" : ["noun" ] },but there are differences between the...

View Article

How to get all objects of JSON array with specific keys using jq? [closed]

{"mainKey": "mainValue","date": "X","values": [ {"keyType1": "someValueX" }, {"keyType1": "someValueY" }, {"keyType2": "someValueZ" }, {"keyType2": "someValueC" }, ]}I need to get all values of objects...

View Article


jq: treat single object as 1-element array

I have several .json files (or rather, .xml files pre-parsed by xq/yq) that I want to parse. Unfortunately, the element I want to read (.size) can be inside an extra array (in which case I'd select one...

View Article

JQ will not deep copy arrays with recursive algorithm

When using this algorithm:jq -s 'def deepmerge(a;b): reduce b[] as $item (a; reduce ($item | keys_unsorted[]) as $key (.; $item[$key] as $val | ($val | type) as $type | .[$key] = if ($type == "object")...

View Article

Can `jq` be forced` to take slightly malformed JSON body?

I like using :!pbpaste | jq to see my JSON objects when reading logs in vim.But it often throws the following error with the slightest inconvenience in the JSON body.jq: parse error: Invalid numeric...

View Article


JSON to plain text using jq

Let's say i got the following json response:{"author": "tomek","title": "helloworld","test": "sampletextonetwothree"}Is it possible to display something like this: (using...

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

Ignore Unparseable JSON with jq

I'm using jq to parse some of my logs, but some of the log lines can't be parsed for various reasons. Is there a way to have jq ignore those lines? I can't seem to find a solution. I tried to use the...

View Article

Using JQ and Bash, merge two jsons [closed]

Using a combination of jq and (if necessary) bash I would like to merge two jsons that are backwards compatible structure-wise; json1 is the base and contains more elements than json2, but all elements...

View Article

How to exclude the elements from one array that exist in another array by...

Assuming two json files:a.json[ {"category": "utils","name": "yq" }, {"category": "utils","name": "yq4" }, {"category": "utils","name": "yip" }, {"category": "utils","name": "jq" }, {"category":...

View Article


Bash compile output into a csv using jq

I am writing a Bash script to create a csv from a sample inconsistent json data but running into a bunch of issues.My json data looks like this :json_data='[ {"ResourceARN": "arn","Tags": [ {"Key":...

View Article

jq command with several tables in the json path

My (huge) input file has many entries , what I want to extract is structured like that:{"vulnerabilities": [ {"parentAlert": {"affectedVersions": [ {"answers": [ {"willBeFixed": true,"fixedInPackage":...

View Article


jq and suppressing standard error message (which does not appear to be error)...

I have JSON output from curl query I did and I am creating another array which later on I will use to create HTML (or CSV and then HTML) in step by step process. However, I always get a what jq says is...

View Article

jq: C:/cygwin64/bin/jq.exe: error while loading shared libraries: ?: cannot...

jq fails with:$ jqC:/cygwin64/bin/jq.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directoryHow can I find out which libary was missing?

View Article


Escape Regex special characters in jq

I want to do search and replace in a larger jq program.The problem is that search may contain special characters that are interpreted as regex functionality, which I dont want. Special characters...

View Article

Converting a CSV file into a nested JSON file using ./jq

I am hoping I can get an answer on this question. I am using ./jq to convert a CSV file into a file of JSON objects. Each line of the CSV input represents a JSON object. A sample of the CSV input is as...

View Article

Add new element stored in a variable to existing JSON array with jq

I am working on creating an adaptive card dynamically. I have the skeleton on the card in JSON and I want to add entries to it (each entry will be a JSON object inside the "body" of the below schema)....

View Article
Browsing all 657 articles
Browse latest View live


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