Skip to content

Program Synthesizer from JSON data sources that produces Transpilable Typed JSON.

Notifications You must be signed in to change notification settings

syall/json-synthesizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-synthesizer

Overview

Program Synthesizer from JSON data sources that produces Transpilable Typed JSON.

Usage

Install the module using npm:

npm install json-synthesizer

To use the synthesizer in node:

// Import synthesize function
const synthesize = require('json-synthesizer');

// Define High Level Specification
const specification = {
  inputOutputExamples: [
    {
      source: 'tag',
      input: {
        // Input JSON
      },
      output: {
        // Restructured Transformed Input
      }
    },
    // ...
  ],
  transforms: [
    {
      source: 'tag',
      transform: function customTransform(json) {
        // Transform JSON
        return transformedJson;
      }
    },
    // ...
  ]
};

// Output Synthesized Typed JSON String
console.log(synthesize(specification));

Exports

// Default Export
module.exports = synthesize;

// VSA Exports
module.exports.vsa = {
  convertJsonToTypedMap,
  convertTypedMapToTypedJson,
  intersects: {
    intersectTypedMaps,
    intersectTypes
  },
  mapTransformsOnJson,
  restructureTypedMaps,
  unions: {
    unionTypedMaps,
    unionTypes
  }
};

// Util Exports
module.exports.util = {
  isType: {
    isArray,
    isNull,
    isObject,
    singleValue
  },
  str
};

Documentation

The main webpage for json-synthesizer can be found at here.

  • Design Documentation is available here.
  • JSDoc Documentation is available here.
  • GitHub Repository is available here.
  • NPM Package is available here.