GithubHelp home page GithubHelp logo

langley / jsonparsers Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 148 KB

A simple project that illustrates the progression from a permissive json parser to a restrictive one that will only accept a strongly defined json object

Scala 100.00%

jsonparsers's Introduction

What's Here

This project shows how to build a "strict json parser" that insures the input is of the required type before transforming it to gson objects. It started from code illustrated here: http://www.artima.com/pins1ed/combinator-parsing.html

Each of the parsers included extends the basic example, see the table of Scala Files below which explains each step of the progression.

The project is a simple SBT project created using the following steps:

  1. g8 typesafehub/scala-sbt
  2. adding the project/plugins.sbt containing the eclipse plugin.

Note the eclipse plugin allows you to use the "eclipse" command in sbt to create the eclipse project support.

Scala Files

Name Illustrates
FirstJsonParser.scala This is the first example from the url above
SecondJsonParser.scala This is the second example from the url above
ThirdJsonParser.scala Adds support for transforming the input json into json objects defined by the google gson library.
FourthJsonParser.scala Moves the parser from generically parsing json into one that is specifically looking for an address book and finding it, transforms it into gson objects.
FifthJsonParser.scala Shows what you need to do to report failures and react to them.

Data Files

Name Used for
addressBook.json the canonical json from the url example
a.json basically the same as addrBook.json
aFail.json an address book that is valid json but not a valid address book.
b.json a VERY simple json object
bFail.json a VERY simple BROKEN json object, not valid json

jsonparsers's People

Contributors

langley avatar

Watchers

 avatar  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.