skip to Main Content

How to convert string to valid json or yaml

I have a large script that parses js with a dataframe entry, but to shorten the question, I put what I need in a separate variable. My variable contains the following value value = "{from:[3,4],to:[7,4],color:2},{from:[3,6],to:[10,6],color:3}" I apply the following script…

VIEW QUESTION

Json – I want, using my private API, to fetch my data but I want them to be checkboxes

Here's what I have so far main.html (it's a form btw) <div class="form-group form-check-inline"> <input class="form-check-input" type="radio" name="region" id="US" value="US"> <label class="form-check-label" for="US">US</label> </div> api.js document.addEventListener('DOMContentLoaded', () => { const urlUS = new URL("http://127.0.0.1:3000/api/v1/regionApi/regionProduct/1") document.getElementById('US').addEventListener('click', getRegionUS) function getRegionUS() { fetch(urlUS,…

VIEW QUESTION

Can't get json with axios.get and headers

I am trying to get the joke from https://icanhazdadjoke.com/. This is the code I used const getDadJoke = async () => { const res = await axios.get('https://icanhazdadjoke.com/', {headers: {Accept: 'application/json'}}) console.log(res.data.joke) } getDadJoke() I expected to get the joke but…

VIEW QUESTION

How to parse nested json to csv using command line

I want to parse a nested json to csv. The data looks similar to this. {"tables":[{"name":"PrimaryResult","columns":[{"name":"name","type":"string"},{"name":"id","type":"string"},{"name":"custom","type":"dynamic"}]"rows":[["Alpha","1","{"age":"23","number":"xyz"}]]]} I want csv file as: name id age number alpha 1 23 xyz I tried: jq -r ".tables | .[] | .columns | map(.name)|@csv"…

VIEW QUESTION

jq convert jsonlines to csv with header without slurp

a potentially huge json-lines file with objects of known structure is to be converted to csv with headers. example {"name":"name_0","value_a":"value_a_0","value_b":"val_b_0"} {"name":"name_1","value_a":"value_a_1","value_b":"val_b_1"} {"name":"name_2","value_a":"value_a_2","value_b":"val_b_2"} {"name":"name_3","value_a":"value_a_3","value_b":"val_b_3"} {"name":"name_4","value_a":"value_a_4","value_b":"val_b_4"} expected output "name","value_a","value_b" "name_0","value_a_0","val_b_0" "name_1","value_a_1","val_b_1" "name_2","value_a_2","val_b_2" "name_3","value_a_3","val_b_3" "name_4","value_a_4","val_b_4" currently tried (if (input_line_number == 1 ) then…

VIEW QUESTION
Back To Top
Search