Page 1 of 1

Exporting JSON, editing, and then reimporting

Posted: 30 Sep 2017 14:47
by algae_tom
Hello,

I'm making some new impact categories, and would like to duplicate my list of flow and give them different figures for various climate change indicators (GWP, GTP, different time horizons, climate-carbon-feedbacks, etc).

Basically as shown in the below image...

Image

I can't just copy and paste, so I tried exporting the impact category as a JSON-LD file, unzipping it, copying the code from one impact category within \lcia_categories to my new one.

So I go from this:

Code: Select all

{"@context":"http://greendelta.github.io/olca-schema/context.jsonld","@type":"ImpactCategory","@id":"00584ca8-2f6d-48c6-a925-411a9d357d19","name":"Climate change - GWP20","description":"GWP20 (IPCC,2013)","version":"00.00.000","referenceUnitName":"kg CO2 eq."}
To this..

Code: Select all

{"@context":"http://greendelta.github.io/olca-schema/context.jsonld","@type":"ImpactCategory","@id":"00584ca8-2f6d-48c6-a925-411a9d357d19","name":"Climate change - GWP20","description":"GWP20 (IPCC,2013)","version":"00.00.000","referenceUnitName":"kg CO2 eq."},"impactFactors":[{"@type":"ImpactFactor","value":10900.0,"flow":{"@type":"Flow","@id":"e93ba406-3df8-4e34-be54-0d556b2bb629","name":"Methane, dichlorodifluoro-, CFC-12"},"unit":{"@type":"Unit","@id":"20aadc24-a391-41cf-b340-3e4529f44bde","name":"kg"},"flowProperty":{"@type":"FlowProperty","@id":"93a60a56-a3c8-11da-a746-0800200b9a66","name":"Mass"}},

...

{"@type":"ImpactFactor","value":359.0,"flow":{"@type":"Flow","@id":"63891f6c-60bb-43e4-9c47-5bdb34889aa0","name":"Ether, 1,1,2,2-Tetrafluoroethyl methyl-, HFE-254cb2"},"unit":{"@type":"Unit","@id":"20aadc24-a391-41cf-b340-3e4529f44bde","name":"kg"},"flowProperty":{"@type":"FlowProperty","@id":"93a60a56-a3c8-11da-a746-0800200b9a66","name":"Mass"}}]}
(ignore the numbers, they're wrong, this is just an example before I make my categories)

Then I rezipped the file and tried to import it as a JSON-LD file into the impact categories. But nothing happens. Any idea what I'm doing wrong.

Any less long winded options to do this also appreciated!

Re: Exporting JSON, editing, and then reimporting

Posted: 04 Oct 2017 03:07
by aciroth
That approach works but you need to fully reflect the JSON-LD structure, e.g. the line breaks should be removed (but I am not certain if they are only added here in the code window).

Re: Exporting JSON, editing, and then reimporting

Posted: 04 Oct 2017 10:53
by algae_tom
Line breaks were just from pasting into the forum, not in my code.

I've found the issue, it's the zipping and unzipping of files, so used 7-zip to edit the files with Notepad++ (but Notepad would work too) whilst keeping the files still zipped.

I'm really enjoying OpenLCA!