JSON or XML to Relational Database

Convert any JSON or XML data into a relational database structure.

Do you need to load your JSON or XML into a relational database? - use this tool.

  • Unlock your JSON or XML and load into your database via SQL
  • Convert JSON or XML directly into a Sqlite database
  • API Design allows you to pass a local file, JSON/XML string, or Web URL
  • Directly query your JSON or XML and output CSV or JSON
  • Convert JSON or XML to SQL INSERT statements

You must have an API token to call our APIs. You are automatically assigned one upon registering and confirming your email. See our tutorial: Two Methods of API Authentication and Example Use below that demonstrate passing your token to our server. You must substitute your token found in the Account page in place of [YOUR TOKEN]. Also, use your data file name instead of [YOUR FILE], i.e. invoices.csv. All conversion APIs require the infile parameter since it is the data you are converting.
Note that to read from an S3 bucket that requires authorization, you must pass both username and password parameters, and the URL must start with s3://.
There is a 80MB limit on input. You may however zip your input file and use it for infile.

Try it Now

Resulting curl command:

Parameter Value Type Description Example Use
infile


string This is the input file: raw data, or URL. Choose one of the options of "Local File", "URL", or "Data" curl -X POST "https://www.convertcsv.io/api/v1/csv2json/" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
string This is the SQL SELECT statement to run. The table name is determined either by the input file name or the tablename parameter. curl -X POST "https://www.convertcsv.io/api/v1/json2db" -F "infile=@[YOUR FILE]" -F "query=select * from example order by 1" -H "Authorization: Token [YOUR TOKEN]"
string SQL table name curl -X POST "https://www.convertcsv.io/api/v1/json2db?tablename=invoice_detail" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
string INSERT {insert text here} INTO ... Also works with the SQL REPLACEstatement. curl -X POST "https://www.convertcsv.io/api/v1/json2db?afterinsert=OR+REPLACE" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
boolean Set all data types to be VARCHAR. curl -X POST "https://www.convertcsv.io/api/v1/json2db?all_char=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
string Bearer string to use in Auth for URLs used as input curl -X POST "https://www.convertcsv.io/api/v1/json2db?bearer=78954237898937598" -F "infile=https://www.data.com/files/inputfile" -H "Authorization: Token [YOUR TOKEN]"
string File encoding - if not passed, the converter will attempt to determine the encoding by looking at the first few thousand bytes of the file. Typical values are: utf-8, utf-16. You can see a list of all supported types here: https://docs.python.org/3/library/codecs.html curl -X POST "https://www.convertcsv.io/api/v1/json2db?encoding=ascii" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
boolean Create GUID for primary key instead of sequential number. curl -X POST "https://www.convertcsv.io/api/v1/json2db?guid=Y" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
boolean Generate INSERT statements curl -X POST "https://www.convertcsv.io/api/v1/json2db?insert=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
boolean Generate JSON output curl -X POST "https://www.convertcsv.io/api/v1/json2db?json=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
boolean Generate JSONL/JSONND output. This format has fully valid JSON on each line. curl -X POST "https://www.convertcsv.io/api/v1/json2db?jsonl=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
boolean Keep namespace prefixes in keys or columns for XML files. curl -X POST "https://www.convertcsv.io/api/v1/json2db?keeppre=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
string Key value of target array in input data. By default the first repeating group is used (JSON array or XML repeating tag). See the "uselargest" option. If your JSON is not an array and you want to use the whole structure, then pass a dash - curl -X POST "https://www.convertcsv.io/api/v1/json2db?key=id" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
integer Limit number of output records to N, i.e. 100. If you have a large output file, use this option to limit your output. curl -X POST "https://www.convertcsv.io/api/v1/json2db?limit=10" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
boolean Input file is JSON Lines (JSON ND). This is auto-detected so setting this option allows auto-detection to be skipped. If converting to JSON - then use this to output JSON Lines. curl -X POST "https://www.convertcsv.io/api/v1/json2db?lines=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
boolean Do not produce INSERT statements curl -X POST "https://www.convertcsv.io/api/v1/json2db?noinserts=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
string Password for URL data source curl -X POST "https://www.convertcsv.io/api/v1/json2db?password=bob&username=bee" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
boolean Show SQL statements used to create the database json2db --sql --infile [YOUR FILE]
string Key(s) to store JSON value as string curl -X POST "https://www.convertcsv.io/api/v1/json2db?storejson=data" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
string Username for URL data source. This is only used when URLs are the data source. See password also. curl -X POST "https://www.convertcsv.io/api/v1/json2db?username=johnny&password=xyz" -F "infile=https://www.xyz.com/myinputfile.csv" -H "Authorization: Token [YOUR TOKEN]"
boolean Pass 1 to indicate input is XML. curl -X POST "https://www.convertcsv.io/api/v1/json2db?xml=1" -F "infile=@[YOUR FILE]" -H "Authorization: Token [YOUR TOKEN]"
<

Pricing

Our Pricing

Free Test Drive

  • Try now and Buy Later - Product plans start at $39/month
  • Test drive ALL our API with no hassle(s)
  • Credit Card is not Required
  • Limited # of Total API calls
Custom

Unique

  • Need something more custom?
  • We can put together custom packages
  • Don't hesitate to contact us
  • We are ready to help!