prepare and escape a string for JSON
Don’t forget the trailing dot.
Don’t forget the trailing dot.
You have to upload your data using curls -d argument. Avoid to construct ad data structure object as a string variable, it’s pita. You will definitely cry abt character encoding. Instead build a well prepared file and use the -d @$FILE parameter. Transfer your data between your scripts base64 encoded. Remove these characters: ” < […]
Use jq and especially jo for string and parameter creation. Handle special-character-problems ( ‘ % $ and million others ) by url encoding your strings directly at the source. chatgpt api natively speaks urlencode. I’ve tried base64, but the chatbot mentions in his answer that he/she was fed with base64 encoded stuff. To encode use […]
Install maildir-utils and use to parse the files and write a json. Use to eliminate bad characters who do not fit into your charset. Some (windows) mail clients (outlook?) put an CRLF at the end of to, cc, bcc or subject , so do something like an Elasticsearch will not accept json files encapsulated in […]
jq -r ‘try(.xyzblablabladoesntexist) // “none”‘
OBJECT: ‘use strict’; var slotIndexes = [ { ‘slot’ : ‘live’, ‘index’: 0 }, { ‘slot’ : ‘achtziger’, ‘index’: 1 }, { ‘slot’ : ‘neunziger’, ‘index’: 2 }, { ‘slot’ : ‘relax’, ‘index’: 3 }, { ‘slot’ : ‘rock’, ‘index’: 4 }, { ‘slot’ : ‘brandneu’, ‘index’: 5 }, { ‘slot’ : ‘black and dance’, […]
curl -s “https://www.pegelonline.wsv.de/webservices/rest-api/v2/stations.json?includeTimeseries=true&includeCurrentMeasurement=true”| jq -j –tab ‘.[] | select( ( .timeseries[0].currentMeasurement.stateMnwMhw==”low” or .timeseries[0].currentMeasurement.stateMnwMhw==”high” ) and .timeseries[0].shortname==”W” ) | [ .number, .water.longname, .longname, .latitude, .longitude, .timeseries[0].currentMeasurement.stateMnwMhw, .timeseries[0].currentMeasurement.trend, .timeseries[0].currentMeasurement.value ] | “\(.[0])|\(.[1])|\(.[2])|\(.[3])|\(.[4])|\(.[5])|\(.[6])|\(.[7])\n”‘)