prods / exjson Goto Github PK
View Code? Open in Web Editor NEWExtended JSON Parser Library for Python
License: MIT License
Extended JSON Parser Library for Python
License: MIT License
Dynamic values will be calculated at run time when the file is included/parsed and cached for reuse on the same file.
Basic Dynamic values:
This should set the foundation for accessing the JSON files tree and future querying using the $. root accessor.
Enhance include directive in order to allow a property name to be provided if the include directive is being called outside of an array.
The property name will precede the file name separated by a colon.
// #INCLUDE "PropertyName:include_file.json"
// #INCLUDE <PropertyName:include_file.json>
When including multiple files at lower levels their path should be relative to the path of the main include file.
Current loads()
should be moved to load()
and loads()
should be a refactoring of the JSON parsing logic.
The new function should accept a path variable in order to process the includes or it will use the executing python script path as default.
loads
includes_path is not provided.When no property is provided and the include directive is being called between other other properties the parser should raise an Attribute error in order to notify the user that the Property name is required.
Add support for default value to be added if no include file is found.
// #INCLUDE "Value:Test.json|[]"
Refactor "_extract_tree" reference tree logic. Current Implementation works but it may be a little bit crude. It should be all created into one single tree. Evaluate performance tunning.
Evaluate adding support for included files to include other files... This requires further refactoring and analysis in order to prevent infinite recursion when an included file tries to include a file thar references it or another one higher in the include hierarchy, which may eventually load it again... This should raise a circular reference error.
A trailing comma is being added after the included code when a comment is found after the include statement without evaluating the code that follows the comment. This works when a property is placed after the comment, but it doesn't when a closing character is found.
Json
{
"Name": "Test",
/* #INCLUDE <Value:values.json> */
// Test
}
Returns (Incorrect)
{
"Name": "Test",
"Value": {
"Values": [ 1, 2, 3]
},
}
Should not return a comma at the end of the Value property value.
Evaluate if the same issue happens when an include is placed right at the beginning of the JSON file with a comment right before it.
{
// TEST
/* #INCLUDE <Value:values.json> */
"Name": "Test"
}
This scenario should return:
{
"Value": {
"Values": [1,2,3]
},
"Name": "Test"
}
Add Logic in order to support including files from an http/https url and implement optional checksum verification.
HTTP Include
/* #INCLUDE "http://exjson.com/lab/test.json" */
Default Value
/* #INCLUDE "http://exjson.com/lab/test.json|{}" */
Checksum (Requires a default value)
/* #INCLUDE "http://exjson.com/lab/test.json|{}|2a53375ff139d9837e93a38a279d63e5 */
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.