Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andude10/parse-json
Json parser written in haskell
https://github.com/andude10/parse-json
haskell-learning json-parser
Last synced: about 6 hours ago
JSON representation
Json parser written in haskell
- Host: GitHub
- URL: https://github.com/andude10/parse-json
- Owner: andude10
- License: bsd-3-clause
- Created: 2024-05-18T17:25:37.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-06-02T00:12:56.000Z (5 months ago)
- Last Synced: 2024-10-11T22:23:20.187Z (26 days ago)
- Topics: haskell-learning, json-parser
- Language: Haskell
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# parse-json
This is a simple JSON parser implemented in Haskell.
- `src/Lexical.hs` Module for lexical analysis (turning a raw content into tokens for further parsing)
- `src/Parse.hs` Module for parsing and APIYou can run `app/Main.hs` to test it in console:
```
>> stack build
>> stack exec parse-json-exe
Please provide filename:
example.json
Parse result:
[
JsonObject [("first_name", [JsonString "John"])],
JsonObject [("last_name", [JsonString "Smith"])],
JsonObject [("is_alive", [JsonBool True])],
JsonObject [("age", [JsonNumber 27.0])],
JsonObject [
("address", [
JsonObject [("street_address", [JsonString "21 2nd Street"])],
JsonObject [("city", [JsonString "New York"])],
JsonObject [("state", [JsonString "NY"])],
JsonObject [("postal_code", [JsonString "10021-3100"])]
])
],
JsonObject [
("phone_numbers", [
JsonObject [("type", [JsonString "home"])],
JsonObject [("number", [JsonString "212 555-1234"])],
JsonObject [("type", [JsonString "office"])],
JsonObject [("number", [JsonString "646 555-4567"])]
])
],
JsonObject [("children", [JsonString "Catherine", JsonString "Thomas", JsonString "Trevor"])],
JsonObject [("spouse", [JsonNull])]
]
```