
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
JSON serializer/deserializer for AssemblyScript
~ npm install json-as
~ npm install visitor-as
Add the transform to your asc
command
--transform json-as/transform
Or, add it to asconfig.json
{
"options": {
"transform": "json-as/transform"
}
}
import { JSON } from "json-as";
@json
class Vec2 {
x: f32
y: f32
}
@json
class Player {
firstName: string
lastName: string
lastActive: i32[]
age: i32
pos: Vec2
isVerified: boolean
}
const data: Player = {
firstName: "Emmet",
lastName: "West",
lastActive: [8, 27, 2022],
age: 23,
pos: {
x: -3.4,
y: 1.2
},
isVerified: true
}
const stringified = JSON.stringify<Player>(data);
// {
// "firstName": "Emmet",
// "lastName": "West",
// "lastActive": [8, 27, 2022],
// "age": 23,
// "pos": {
// "x": -3.4000000953674318,
// "y": 1.2000000476837159
// },
// "isVerified": true
// }
console.log(`Stringified: ${stringified}`);
const parsed = JSON.parse<Player>(stringified);
// Player {
// firstName: "Emmet",
// lastName: "West",
// lastActive: [8, 27, 2022],
// age: 23,
// pos: {
// x: -3.4000000953674318,
// y: 1.2000000476837159
// },
// isVerified: true
// }
console.log(`Parsed: ${JSON.stringify(parsed)}`);
Please submit an issue to https://github.com/JairusSW/as-json/issues if you find anything wrong with this library
FAQs
The only JSON library you'll need for AssemblyScript. SIMD enabled
The npm package json-as receives a total of 0 weekly downloads. As such, json-as popularity was classified as not popular.
We found that json-as demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.