https://github.com/henryquan/json-become-ts
JSON to TypeScript/Dart converter
https://github.com/henryquan/json-become-ts
converter dart flutter javascript json typescript web
Last synced: 2 months ago
JSON representation
JSON to TypeScript/Dart converter
- Host: GitHub
- URL: https://github.com/henryquan/json-become-ts
- Owner: HenryQuan
- License: mit
- Created: 2020-02-04T09:26:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T05:55:23.000Z (over 3 years ago)
- Last Synced: 2025-03-11T15:52:24.916Z (over 1 year ago)
- Topics: converter, dart, flutter, javascript, json, typescript, web
- Language: Dart
- Homepage: https://json2ts.web.app
- Size: 1.52 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JSON: Become TS
Work in progress JSON to TypeScript converter.
## About
It was called `json2ts` but others have used this name so I changed it to `JSON: Become TS`. Yes, the naming is inspired by a certain game.
It is another tool that I need for [WoWs Info](https://github.com/HenryQuan/WoWs-Info-Re). Other tools I found only generate everything in a single file and that's not what I want. Therefore, `JSON: Become TS` will help you to create files and directories automatically.
### Dart support
Dart support has been added but it might need some manual adjustments due to the type `number` can be both `int` and `double`.
### Features
- Support `number`, `string`, `boolean`
- Support `array` and auto detect `map`
- Remove illegal characters
The next step is to support optional types. It might be possible with the help of [obj-join](https://github.com/HenryQuan/obj-join). After that, I will add the option to generate classes instead of interfaces.
## Example
- Check the [example](https://github.com/HenryQuan/json-become-ts/tree/master/src/example) folder to see what it does
- Check the [modules](https://github.com/HenryQuan/json-become-ts/tree/master/src/example/modules) folder for dart
### Special thanks
Checkout [this website](https://next.json-generator.com/) for generating random json.
For legacy JS code, check them [here](https://github.com/HenryQuan/json-become-ts/tree/aeda8cbfdea101b1464e6ce987c3918346f04e51).