jq

Json to CSV issues

夙愿已清 提交于 2021-02-11 02:45:31
问题 I am using pandas to normalize some json data. I am getting stuck on this issue when more than 1 section is either an object or an array. If i use the record_path on Car it breaks on the second. Any pointers on how to get something like this to create a line in the csv per Car and per Location? [ { "Name": "John Doe", "Car": [ "Car1", "Car2" ], "Location": "Texas" }, { "Name": "Jane Roe", "Car": "Car1", "Location": [ "Illinois", "Kansas" ] } ] Here is the output Name,Car,Location John Doe,"[

How to loop over jq unique array in bash?

混江龙づ霸主 提交于 2021-02-10 17:52:37
问题 I'm trying to loop over unique names and commit messages from a github json object. However when there are spaces in the arrays bash will treat them as individual array items #!/usr/bin/env bash commits='[ { "author": { "email": "email@example.com", "name": "Chris", "username": "chris" }, "committer": { "email": "email@example.com", "name": "Chris", "username": "chris" }, "message": "commit message 1" }, { "author": { "email": "email@example.com", "name": "John", "username": "jdoe" },

How to loop over jq unique array in bash?

≯℡__Kan透↙ 提交于 2021-02-10 17:51:28
问题 I'm trying to loop over unique names and commit messages from a github json object. However when there are spaces in the arrays bash will treat them as individual array items #!/usr/bin/env bash commits='[ { "author": { "email": "email@example.com", "name": "Chris", "username": "chris" }, "committer": { "email": "email@example.com", "name": "Chris", "username": "chris" }, "message": "commit message 1" }, { "author": { "email": "email@example.com", "name": "John", "username": "jdoe" },

How to loop over jq unique array in bash?

心已入冬 提交于 2021-02-10 17:49:20
问题 I'm trying to loop over unique names and commit messages from a github json object. However when there are spaces in the arrays bash will treat them as individual array items #!/usr/bin/env bash commits='[ { "author": { "email": "email@example.com", "name": "Chris", "username": "chris" }, "committer": { "email": "email@example.com", "name": "Chris", "username": "chris" }, "message": "commit message 1" }, { "author": { "email": "email@example.com", "name": "John", "username": "jdoe" },

jq recursively update values for certain elements

别等时光非礼了梦想. 提交于 2021-02-10 17:27:37
问题 The intent for the JSON data below is to update the value of the field dst with the value of src within all elements of type t , regardless of depth within the tree, while at the same time preserving the whole structure of the data. Is this possible with jq ? My several attempts have boiled down to the following command that is not working to achieve the intended purpose: $ jq -r 'map_values(select(.. | .type? == "t" |= (.dst = .src)))' { "a": "b", "c": [ { "type": "t", "src": "xx", "dst":

How to add a bash array into the fields of a JSON array using jq?

大兔子大兔子 提交于 2021-02-10 15:52:07
问题 I currently have the following JSON output from echo $items | jq : { "Family_Name": "Type 1", "Quantity_On_Hand": "335" } { "Family_Name": "Type 2", "Quantity_On_Hand": "215" } { "Family_Name": "Type 9", "Quantity_On_Hand": "159" } { "Family_Name": "Type 4", "Quantity_On_Hand": "500" } I also have a bash array colors of the same size looking like "Blue" "Red" "Green" "Blue" How can I use jq so that I get something like { "Family_Name": "Type 1", "Quantity_On_Hand": "335", "Colors": "Blue" } {

How to add a bash array into the fields of a JSON array using jq?

回眸只為那壹抹淺笑 提交于 2021-02-10 15:46:58
问题 I currently have the following JSON output from echo $items | jq : { "Family_Name": "Type 1", "Quantity_On_Hand": "335" } { "Family_Name": "Type 2", "Quantity_On_Hand": "215" } { "Family_Name": "Type 9", "Quantity_On_Hand": "159" } { "Family_Name": "Type 4", "Quantity_On_Hand": "500" } I also have a bash array colors of the same size looking like "Blue" "Red" "Green" "Blue" How can I use jq so that I get something like { "Family_Name": "Type 1", "Quantity_On_Hand": "335", "Colors": "Blue" } {

jq merge arrays inside object [closed]

假装没事ソ 提交于 2021-02-10 15:11:44
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . Improve this question I have two objects { "a": [ "1-1", "1-2" ], ... } and { "a": [ "2-1", "2-2", "2-3" ], ... } there are other keys in both objects, but I don't care for them. What I want to get is the object where elements of "a" will be concatenated: { "a": [ "1-1", "1-2", "2-1", "2-2", "2-3"

Stream Parse Huge JSON file into small files

狂风中的少年 提交于 2021-02-10 06:15:25
问题 I have around 96 gzip of JSON which is over 350 GB of JSON file after unzipping with following structure { "structe": {}, "beta": {}, "flow": { "1023": { "0101": { "-LEjllNyHqdHYGntO6vu": { "status": "1", "t": 1528736191996 }, "-LEjllcXKaVOQu3BDpHF": { "status": "1", "t": 1528736192996 } }, "0102": { "-LEjllNyHqdHYGntO6vu": { "status": "1", "t": 1528736191996 }, "-LEjllcXKaVOQu3BDpHF": { "status": "1", "t": 1528736192996 } } }, "1024": { "0103": { "-LEjllNyHqdHYGntO6vu": { "lat": 51

《小学四则运算练习软件软件需求说明》结对项目报告

时间秒杀一切 提交于 2021-02-10 06:06:22
一 调查过程   首先,我们以实验三所开发的软件作为原型对少部分人进行了现场测验,得到了用户反馈,再填写调查问卷,更加精准的了解我们软件的用户的需求。   其次,我们让较多的人来填写调查问卷,调查对象主要是小学生,正在小学任教的数学老师。我们对小学生进行了问卷形式的调查,对教师是对新疆支教的学长学姐微信进行了一次采访。 调查问卷链接: https://www.wjx.cn/jq/22599401.aspx?t=636596494772138750 1: 以下是对小学生的调查问卷数据统计表: 2:对老师的采访图 3:根据调查后功能分析表 功能 概述 注册 所有用户根据实际情况注册,其中包括职业、班级等,相同学校和班级的将会分为同一类 登录 用户登录自己的唯一账户,进入不同的功能界面 选择年级 小学生是该软件的主要用户,练习题目之前可以选择自己的年级,进行有针对性地做题 练习四则运算 四则运算包括分数、整数、带括号的运算,学生可以 进行多轮计算训练,家长和老师可以体验 奖励制度 当学生提交运算结果时,软件自动打分,60-70分一颗星,71-80分两颗星,81-90三颗星,91-99四颗星,100分五颗星,当达到一定数量以后,可升级为月亮,以此鼓励学生。 错题本 对于学生做错的题目,形成一本错题本,方便学生复习。 高级训练模式 针对学生的错题本,分析出学生的错题类型