
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
@gelight/json2sml
Advanced tools
Node package to convert JSON to SML
This library depends on SML (Simple Markup Language)
// Import the converter class from the module
import { Converter } from "@gelight/json2sml";
// JSON example
let json = {
"firstName": "John",
"lastName": "Smith",
"age": 27,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021-3100"
}
}
// Use the converter to generate your SML document based on your JSON object
let doc = Converter.convert(json);
// Output > Logs all SML attributes from the SML element "address"
console.log(doc.getRoot().getElement("address").getAttributes());
Output:
[
SmlAttribute {
whitespaces: null,
comment: null,
name: 'streetAddress',
values: [ '21 2nd Street' ]
},
SmlAttribute {
whitespaces: null,
comment: null,
name: 'city',
values: [ 'New York' ]
},
SmlAttribute {
whitespaces: null,
comment: null,
name: 'state',
values: [ 'NY' ]
},
SmlAttribute {
whitespaces: null,
comment: null,
name: 'postalCode',
values: [ '10021-3100' ]
}
]
<html>
<head>
<title>JSON2SML - Node package to convert JSON to SML</title>
</head>
<body>
<script src="https://unpkg.com/@gelight/json2sml"></script>
<script>
let json = {
"firstName": "John",
"lastName": "Smith",
"age": 27,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021-3100"
}
};
let doc = JSON2SML.Converter.convert(json);
console.log(doc.getRoot().getElement("address").getAttributes());
</script>
</body>
</html>
FAQs
Node package to convert JSON to SML
The npm package @gelight/json2sml receives a total of 2 weekly downloads. As such, @gelight/json2sml popularity was classified as not popular.
We found that @gelight/json2sml demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.