Files
transform/pages/jsonld-to-expanded.tsx
Ritesh Kumar 0003d2faa8 feat(jsonld): added flatten, compact, n-quads, expanded and framed (#110)
* fixes

* feat(jsonld): added flatten, compact, n-quads, expanded and framed

closes #109
2019-07-19 18:29:39 +05:30

24 lines
582 B
TypeScript

import ConversionPanel from "@components/ConversionPanel";
import { useCallback } from "react";
import * as React from "react";
import { expand } from "jsonld";
export default function() {
const transformer = useCallback(async ({ value }) => {
const jsonLd = await expand(JSON.parse(value));
return JSON.stringify(jsonLd, null, 2);
}, []);
return (
<ConversionPanel
transformer={transformer}
editorTitle="JSON-LD"
editorDefaultValue="jsonLd"
editorLanguage="json"
resultTitle="Expanded"
resultLanguage={"json"}
/>
);
}