RAML to JSON Converter - ramldt2jsonschema

I need to convert RAML to JSON and have found a tool named ramldt2jsonschema and have followed instructions at https://www.npmjs.com/package/ramldt2jsonschema to install it on Ubuntu Linux as a command line executable using npm and using sudo to install using admin privileges. This works okay when installed using sudo however, my goal is to install ramldt2jsonschema (or it’s javascript code) on a Windows or Linux machine where I don’t have root privileges or an admin account. Does anyone know if it’s feasible to run the dt2js.js javascript code from an os command line using an invocation like node dt2js.js person.raml human ? Seems like this should work but running it this way produces no error messages or output.

Not sure regarding running as non-root. However I want to warn you about latest version 0.3.1 of ramldt2jsonschema. It is broken! Latest version doesn’t handles types. Simply can’t find types in project. That’s why I rolled back to previous 0.3.0.

Thanks for the heads up regarding version 0.3.1. Since I’m aiming to get the basic ramldt2jsonschema package running under a non-root ID, 0.3.1 is good enough for now.

I found that I can run a non-root installed instance of the javascript code under Node by tweaking the dt2js.js module and adding these lines to the bottom of the script:

var ramlFile = "simple.raml"
console.log('Reading ' + ramlFile);
var ramlData = fs.readFileSync(ramlFile).toString()
var typeName = "User"
dt2js(ramlData, typeName, writeToConsole)

Github has a site named Simple RAML with an example of a very basic API definition which I put into a local file named simple.raml and obtained the following output:

RUNNING dt2js.js
Reading simple.raml
"properties": {
"firstName": {
"type": "string"
"lastName": {
"type": "string"
"age": {
"maximum": 125,
"type": "integer",
"minimum": 0
"additionalProperties": true,
"type": "object",
"required": [
"$schema": "http://json-schema.org/draft-04/schema#"

which looks pretty good for starters…

1 Like

you can use https://www.coolutils.com/XMLViewer It supports not only XML but also JSON and FO files. You can expand or collapse nodes in your XML files for better view. You can convert XML to JSON. The app can print your XML, JSON and FO files or produce full reports about them. i hope you can get benefit from that and besides that you can see other converters also according to your need.
All the best.