Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Parse property from json file Post 303042445 by Neo on Wednesday 25th of December 2019 03:20:07 AM
Old 12-25-2019
FYI, many of us "everyday JSON slingers" here do not process JSON files and JSON API output with grep, awk and sed, etc.

We process JSON with JSON processing tools.

Some use Javascript, PHP and Python (like me) and the built-in JSON processing or libs available, others here use "sed-like" jq.

Code:
https://stedolan.github.io/jq/

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

source a property file in script give error

I have sourced a property file in my script like this to load some variables in the script Then i am able to echo all the property file values inside script but the script is not able to recognize other unix commands #!/bin/bash . build.properties mkdir build i am getting error ... (3 Replies)
Discussion started by: codeman007
3 Replies

2. Shell Programming and Scripting

perl use property file for variables

if I have a file that contains variables. How do I assign them in a script. file p=c e=g Thanks (3 Replies)
Discussion started by: 3junior
3 Replies

3. Shell Programming and Scripting

change word in a property file

Hi, I have a property file called "inspector.properties". In this property file stands the following: inspect=ON Now I want to have a shell script that when you run it, changes the ON in OFF in this property file. Is this possible with sed? Can anybody help me with this? Tnx very much. (5 Replies)
Discussion started by: thebladerunner
5 Replies

4. Shell Programming and Scripting

Report a missing property and property value mis match script.

Hi All, I have 2 properties files - one is a master templete and other one is a node specific properties file, I need to comapre these 2 properties files and make sure the node Specific properties file contains all the properties in the master temple properties file else report the missing... (5 Replies)
Discussion started by: jayka
5 Replies

5. Shell Programming and Scripting

Reading a property file through shell script???

Hi! i need a script that can read a property file. i.e., A script to read a "property" from property file. Read the property value and based on value of property, decide whether to start the some dataload activity or not. Its urngent. Can anyone help me out???:( (7 Replies)
Discussion started by: sukhdip
7 Replies

6. Shell Programming and Scripting

reading and updating property file

I have to do a read operation for a field in property file, which looks like follows: 123|xyz|datetime|count '|' is delimiter. Finally I managed to read the contents of property file using statement like cut -d"|" -f1 $PROPERTIES_FILE | tr '\n' ' ' <-- Reading first column But now I... (2 Replies)
Discussion started by: rakeshranjanscs
2 Replies

7. Shell Programming and Scripting

Property file processing in unix

Hi genius, Following is the problem. We have one templete file(input file) where some variables will be used Example: word1 word2 &{word3} word4 ${word5} word6 And also we have one property file where we define these variables Example: word3= something Word5= something Need to read... (5 Replies)
Discussion started by: gjarms
5 Replies

8. Shell Programming and Scripting

URL extraction from JSON file

I'm trying to export URLs from within a JSON file which in turn resulted from export of Mozilla-Firefox bookmarks. Its single line file with below given values from awk $ awk 'END { print NR }' bookmarks.json 1 $ awk 'END { print NF }' bookmarks.json 2706 $ awk -F, 'END { print NF }'... (6 Replies)
Discussion started by: busyboy
6 Replies

9. Shell Programming and Scripting

Bash script - cygwin (powershell?) pull from GitHub API Parse JSON

All, Have a weird issue where i need to generate a report from GitHub monthly detailing user accounts and the last time they logged in. I'm using a windows box to do this (work issued) and would like to know if anyone has any experience scripting for GitAPI using windows / cygwin / powershell?... (9 Replies)
Discussion started by: ChocoTaco
9 Replies
json::write(3tcl)						       JSON							 json::write(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
json::write - JSON generation SYNOPSIS
package require Tcl 8.5 package require json::write ?1.0.1? ::json::write indented ::json::write indented flag ::json::write aligned ::json::write aligned flag ::json::write string s ::json::write array arg... ::json::write object key value... _________________________________________________________________ DESCRIPTION
The json::write package provides a simple Tcl-only library for generation of text in the JSON http://www.json.org/ data exchange format as specified in RFC 4627 http://www.ietf.org/rfc/rfc4627.txt. COMMANDS
::json::write indented This method returns the current state of the indentation setting. ::json::write indented flag This and the method aligned configure the layout of the JSON generated by the package. If this flag is set (default) the package will break the generated JSON code across lines and indent it according to its inner structure, with each key of an object on a separate line. If this flag is not set, the whole JSON object will be written on a single line, with minimum spacing between all elements. ::json::write aligned This method returns the current state of the alignment setting. ::json::write aligned flag This and the method indented configure the layout of the JSON generated by the package. If this flag is set (default) the package ensures that the values for the keys in an object are vertically aligned with each other, for a nice table effect. To make this work this also implies that indented is set as well. If this flag is not set, the output is formatted as per the value of indented, without trying to align the values for object keys. ::json::write string s This method takes the string s and returns it properly quoted for JSON as its result. ::json::write array arg... This method takes a series of JSON formatted arguments and returns them as a properly formatted JSON array as its result. ::json::write object key value... This method takes a series of key/value arguments, the values already formatted for JSON, and returns them as a properly formatted JSON object as its result, with the keys formatted as JSON strings. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category json of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
data exchange, exchange format, javascript, json CATEGORY
CGI programming COPYRIGHT
Copyright (c) 2009-2011 Andreas Kupries <andreas_kupries@sourceforge.net> json 1.0.1 json::write(3tcl)
All times are GMT -4. The time now is 03:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy