We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How could one parse this into a JSON object? Does each property need a class declared?
{ "name": "Public parking", "cars": [ { "plate": "ABC", "owner": { "name": "John", "dob": "2002-01-01" } }, { "plate": "XYZ", "owner": { "name": "Mary", "dob": "1998-01-01" } } ] }
dob is of type Date.
dob
Thanks!
The text was updated successfully, but these errors were encountered:
JSON.stringify()
You need to add @serializable to each class you want to parse into.
@serializable
@serializable class Parking { name: string, cars: Array<Car> } @serializable class Car { plate: string, owner: Person, } @serializable class Person { name: string, dob: string, } ... import * as JSON from "@serial-as/json"; let parkingLot: Parking = JSON.parse(`{...}`);
Sorry, something went wrong.
Thank you! Hope the author will add this to README
No branches or pull requests
How could one parse this into a JSON object? Does each property need a class declared?
dob
is of type Date.Thanks!
The text was updated successfully, but these errors were encountered: