Exporting JSON, editing, and then reimporting

Post Reply
algae_tom
Posts: 9
Joined: 26 Sep 2017 10:33

Exporting JSON, editing, and then reimporting

Post by algae_tom » 30 Sep 2017 14:47

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!

aciroth
Posts: 750
Joined: 09 May 2010 23:28

Re: Exporting JSON, editing, and then reimporting

Post by aciroth » 04 Oct 2017 03:07

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).

algae_tom
Posts: 9
Joined: 26 Sep 2017 10:33

Re: Exporting JSON, editing, and then reimporting

Post by algae_tom » 04 Oct 2017 10:53

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!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 14 guests