Skip to main content

Loading files from URL

Loading a jcamp from URL

If your NMR spectra are available from a URL it can be loaded directly by using the following syntax

https://www.nmrium.org/nmrium#?jcamp=jcampURL

Where URL is the url that allows to retrieve the jcamp. Because you are appending the URL after #? this information is not submitted to the server and therefore is suitable even with confidential information (a URL containing an access token for example).

Here is an example of a working URL that loads a jcamp directly in NMRium.

https://www.nmrium.org/nmrium#?jcamp=https://cheminfo.github.io/nmr-dataset-demo/ethylbenzene/1h.jdx

Loading an inline JCAMP-DX

In some application it may be easier to directly add the JCAMP-DX in the URL. Please note however that a URL is limited in length depending on the browser. As of September 2022:

  • Google Chrome and Edge : 2,097,152 characters
  • Mozilla Firefox: unlimited
  • Safari: 80,000 characters

Please note however that you need to add a # in order to prevent your browser to send us any information.

Don't forget that the JCAMP-DX has to be url encoded using in javascript encodeURIComponent.

Demo link

Loading a NMRium file from URL

NMRium files contains all the information related to the spectra to display. This includes the data (or where to find the data), the processing and the assignment.

Here is an example of a working URL that loads a NMRium file format directly in NMRium.

https://www.nmrium.org/nmrium#?nmrium=https://cheminfo.github.io/nmr-dataset-demo/coffee/coffee.nmrium

Loading a table of contents

It you would like to have a menu on the left containing many examples you should load a correctly formatted .json file. In this case the URL has the following structure:

https://www.nmrium.org/nmrium#?json=jsonURL

Here is an example of the content of the toc json file:

[
{
"file": "./artemisin/1h.json",
"title": "artemisin",
"view": "",
"selected": true
},
{
"file": "./borohydride/1h.json",
"title": "borohydride",
"view": ""
},
{
"file": "./cyclopropanes/1h.json",
"title": "cyclopropane derivatives",
"view": ""
},
{
"file": "./cyclopropnes_wrongPhase/1h.json",
"title": "cyclopropane derivatives with wrong phase",
"view": ""
},
{
"file": "./geraniol/1h.json",
"title": "geraniol",
"view": ""
},
{
"file": "./glucose/1h.json",
"title": "glucose",
"view": ""
}
]

The file attribute will contain the relative link to an NMRium file (encodes as a JSON) that describes the set of jcamp-dx to load. It may also contain chemical structures.

{
"spectra": [
{
"data": {},
"id": "0abwvynpah97",
"source": {
"jcampURL": "./artemisin/1h.jdx"
},
"display": {
"name": "artemisin",
"color": "#C10020"
}
}
],
"molecules": [
{
"molfile": "68827\r\n -OEChem-12311614122D\r\n\r\n 42 45 0 0 0 0 0 0 0 0999 V2000\r\n 4.3177 0.4203 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.7899 1.1100 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\r\n 6.4870 -0.3207 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\r\n 4.5402 1.3953 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\r\n 7.4004 -1.8275 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\r\n 4.6664 -0.2988 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 3.7655 0.1351 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 4.7603 -1.3362 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 2.8959 -0.4383 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.5674 0.1351 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 3.9042 -1.9296 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 3.5430 1.1100 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 2.9657 -1.4776 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.6389 -1.8668 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.1664 1.8919 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 4.1664 1.8919 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 2.0000 0.0059 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 6.5237 -1.3465 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.6330 -2.8668 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.3890 2.8668 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\r\n 2.9996 0.5039 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 4.7870 -2.1858 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 2.3803 -0.7826 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.8780 -0.6561 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 3.5436 -2.4339 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 4.3394 -2.3712 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 3.1564 1.5948 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 2.9844 0.8410 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 2.3491 -1.4127 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 2.7963 -2.0740 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 6.1762 -2.1762 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 4.3044 2.4963 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 3.6078 2.1609 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 2.2755 0.5614 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 1.4446 0.2814 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 1.7246 -0.5495 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.0130 -2.8632 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.6294 -3.4868 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 6.2530 -2.8704 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.9934 2.7288 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 5.5269 3.4712 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 4.7845 3.0048 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\r\n 1 4 1 0 0 0 0\r\n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\nM ZZC 19 17\r\nM ZZC 20 15\r\nM ZZC 21 29\r\nM ZZC 22 23\r\nM ZZC 23 28\r\nM ZZC 24 21\r\nM ZZC 25 25\r\nM ZZC 26 24\r\nM ZZC 27 31\r\nM ZZC 28 30\r\nM ZZC 29 27\r\nM ZZC 30 26\r\nM ZZC 31 22\r\nM ZZC 32 32\r\nM ZZC 33 33\r\nM ZZC 34 40\r\nM ZZC 35 41\r\nM ZZC 36 42\r\nM ZZC 37 37\r\nM ZZC 38 38\r\nM ZZC 39 39\r\nM ZZC 40 34\r\nM ZZC 41 35\r\nM ZZC 42 36\r\nM END\r\n"
}
]
}

Here is a working example https://www.nmrium.org/nmrium#?toc=https%3A%2F%2Fcheminfo.github.io%2Fnmr-dataset3%2Fmultiplet%2Findex.json