Skip to content

noahbuscher/toy-json-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

(Yet Another) Toy JSON Parser

./src/parser.ts is a toy JSON parser built in Typescript to educate myself a bit better on how lexers (tokenizers) and parsers work. I thought JSON would be easy enough as the spec is relatively small.

Please do not rely on this library. It's not fully to spec.

Use

You can see the module in action in ./src/demo.ts.

const jsonBlob = `
{
	"species": "Washingtonia filifera",
	"alternative_names": [
		"desert fan palm",
		"California fan palm"
	],
	"max_height": "66 ft"
}
`;
const parser = new Parser();

// Lex, parse, and retrieve the JS object
const parsedJSON = parser.parse(jsonBlob);

Todo

  • Numbers support
  • null support
  • Array support
  • Object support
  • String support
  • Boolean support

About

Tiny toy JSON(like) parser, written in Typescript

Topics

Resources

License

Stars

Watchers

Forks