Turtle to JSON-LD converter for node.js and browser, no dependencies for the library. ttl2jsonld.js is a JavaScript library that can be used to create a Turtle (Terse RDF Triple Language) for converting JSON-LD structured data.
json ld generator, json ld example, json ld vs json schema, convert json ld to json
How to make use of it:
1. Install & download.
# NPM $ npm i @frogcat/ttl2jsonld
2. Create a textarea
component to accept Turtle input.
<textarea id="input"></textarea>
3. Create a pre
component to show the converter JSON-LD structured information.
<pre id="output">Click 'convert' to run</pre>
4. Create a button to perform the conversion.
<button>Convert</button>
5. Load the ttl2jsonld.js JavaScript library within the doc.
<script src="/path/to/cdn/jquery.slim.min.js"></script> <script src="/path/to/ttl2jsonld.js"></script>
6. The JavaScript to activate the Turtle To JSON-LD Converter.
$("button").click(function() { try { var t = $("#input").val(); var j = ttl2jsonld.parse(t); $("#output").text(JSON.stringify(j, null, 2)); } catch (e) { console.log(e); alert(e); } });
Turtle To JSON-LD Converter, Turtle to JSON-LD Plugin/Github
See Demo And Download
Official Website(frogcat): Click Here
This superior jQuery/javascript plugin is developed by frogcat. For extra advanced usage, please go to the official website.