Coder Social home page Coder Social logo

jsondl's Introduction

JSONDL - a JSON declaration language

A domain specific language to document and validate JSON data in your JavaScript projects.

JSONDL is natural and javascripty. It is simple like this:

person.jsondl:

{
    "name": string,
    "age": number
}

app.js:

var jsondl = require('jsondl')

var personDecl = jsondl.load(require.resolve('./person.jsondl'))

if (personDecl.test({ name: 'Dan', age: '25' })) {
    console.log('Wow!')
}

What is JSONDL?

A programming language that lets you declare your JSON data.
JSONDL is a superset of JSON, meaning that any JSON file is its own declaration.

What is a JSON declaration?

A convenient way to document your JSON data: its structure, types and constraints.
It is also a precise specification that can be fed into a JSON validator.

JSON declarations are essentially data patterns. A JSON instance is valid if it matches a particular pattern.

Benefits

Readable - Declarations look similarly to validated data. You can actually develop a JSON declaration by editing a JSON file.

Intuitive - JSONDL is much like a type system for JSON. If you like Flow or Typescript, you will find it familiar.

Modular - Use ES6 imports and exports in your JSONDL files. Organize your declarations as any other code. No more intangible dependencies.

Extendable - Write your own extensions in JavaScript. The simplest kind of custom validator is just a function that accepts a single argument and returns true or false. Import your Javascript extensions directly into JSONDL.

Scalable - Publish your declarations and extensions as JavaScript packages and let others import or require them in their own projects.

JSONDL is work in progress. For more features, please look at functional tests in the test directory.

Installation

npm install jsondl

License

MIT

jsondl's People

Contributors

kkeri avatar

Watchers

 avatar

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.