Json - Library

About

Library or software that can parse Json file

List

Language Name Description
Stream, File, Console jq a command-line JSON processor.
Java Org.Json org.json Parses a JSON (RFC 4627)
Java Jackson How to read and write JSON data with Jackson Core?

Javascript

Language Name Description
Javascript text Directly as text
Javascript global JSON object ES5 introduced a new global JSON object for reading and writing (stringify) the JSON data format.
  • Node: Reading a JSON from a file
const dataObject = JSON.parse(fs.readFileSync('data/file.json').toString());
await util.promisify(fs.writeFile)('./dir/file.json', JSON.stringify(object, null, ' '));

Example

Javascript

  • Json can be read natively by javascript
// a variable
var human = {  
     name : "Robot",
     sex : "Unknown"        
}
// we call the function  
console.log(human.name+" has a "+ human.sex+ " sex"); 
// a variable
var humanObject = {  
     name : "Robot",
     sex : "Unknown"        
}
// we call the function  
console.log(JSON.stringify(humanObject)); 

Javascript Prettify

with spacing level = 2

var str = JSON.stringify(obj, null, 2); 

Java

String json = "{"
         + "  \"query\": \"Pizza\", "
         + "  \"locations\": [ 94043, 90210 ] "
         + "}";

 JSONObject object = (JSONObject) new JSONTokener(json).nextValue();
 String query = object.getString("query");
 JSONArray locations = object.getJSONArray("locations");

Documentation / Reference





Discover More
What is JSON (JavaScript Object Notation)?

JSON 99)) is a structured text format that stands for JavaScript Object Notation. It is a simple text format that can be used for representing nested structures of data (lists of...



Share this page:
Follow us:
Task Runner