Code Monkey home page Code Monkey logo

exjson's People

Contributors

prods avatar

Watchers

 avatar  avatar

exjson's Issues

Include: Add support for dynamic values.

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:

  • $.uuid()
  • $.date.now()
  • $.date.now().utc()

This should set the foundation for accessing the JSON files tree and future querying using the $. root accessor.

Move loads() to load() and create a new loads() function that supports processing of a provided JSON string.

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.

  • Refactor JSON String processing logic into loads()
  • Update load() logic so it uses loads() to parse the json file.
  • Update and add unit test in order to cover load and loads()
  • Add logic to use execution python script as root for includes if loads includes_path is not provided.
  • Allow relative path to be used in the include directive.
  • Add Unitest

Refactor Reference Calls logic

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.

  • Consolidate source tree, ref tree and ref list into a single tree dictionary
  • Eliminate unnecessary calls to tree extract

Incude: Evaluate Recursive #Includes.

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.

  • Analyze how to efficiently create the Include hierarchy
  • Review required refactoring

Include: Fix issue where trailing comma is added when following code is a comment followed by a closing character `}` or `]`.

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"
}

Include: Include files from http url with optional checksum verification.

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 */

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.