简体   繁体   English

节点JS-json到jsongraph转换器

[英]Node JS - json to jsongraph converter

I need to convert normal JSON to JSON Graph. 我需要将普通的JSON转换为JSON Graph。 I tried json-graphify but the "import" statement in it throws an error saying it is not supported now. 我尝试了json-graphify,但是其中的“ import”语句抛出错误,表明现在不支持该语句。

The code contained in json-graphify's src/ directory is the prebuilt/precompiled code, which uses syntax not yet available to node or browsers. json-graphify的src/目录中包含的代码是预构建/预编译的代码,其使用的语法尚不适用于节点或浏览器。 The module's author didn't check in the compiled code to github, though it is available on npm (notice the project's main entry file points to lib/index.js , not src/index.js ). 该模块的作者没有将编译后的代码检入到github中,尽管它可以在npm上使用(注意项目的主入口文件指向lib/index.js ,而不是src/index.js )。

You either need to: compile it yourself via babel src --out-dir lib --optional runtime (see the project's compile script ), or install the module via npm. 您需要:通过babel src --out-dir lib --optional runtime (请参见项目的compile脚本 )自行编译 ,或通过npm安装模块。 The former approach will build the compiled code into the lib/ directory. 前一种方法会将编译后的代码构建到lib/目录中。 The latter (probably the recommended approach) will download a precompiled version that can be used via const graphify = require('json-graphify') . 后者(可能是推荐的方法)将下载可通过const graphify = require('json-graphify')使用的预编译版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM