Ask Your Question
0

How to parse JSON files

asked 2019-05-17 20:56:18 +0200

Mopar1973Man gravatar image

I would like to be able to parse JSON files into Libre Calc. I'm attempting to read a file from a vehicle tuner and want to populate a spreadsheet with the data. Then be able to do editing to the data and then save it back to JSON file. I know Microsoft Excel does this but I'm not a Microsoft owner. Is it possible to do this in Calc?

edit retag flag offensive close merge delete

Comments

This is not based on a server. The JSON file is exported from a vehicle tuner as a file.

All I want to do is read the JSON file populate a spreadsheet and then after editing to save the data back to the JSON file again. I'm not sure how python is going to populate a Calc spreadsheet being it's not on a server but a simple 559 byte file you export from a mobile device.

{"profileName":"Economy Beta","vehicleName":"V2 Dodge 1998-2002","settingsMap":{"125":"103","133":"134","128":"113","127":"109","139":"20","111":"15","19":"0","116":"83","17": "1.5","118":"86","112":"15","22":"40","131":"125","61":"3","115":"82","62":"30","129":"117","126": "106","114":"81","136":"149","121":"92","140":"23","130":"121","119":"88","104":"3200","85": "1200","60":"50","138":"18","113":"80","124":"100","122":"94","135":"144","132":"129","59": "5","15":"8","134":"139","110":"0","120":"90","137":"15","123":"97","18":"100","141":"27","117":"84"}}

Mopar1973Man gravatar imageMopar1973Man ( 2019-05-17 21:42:14 +0200 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2019-05-18 22:19:53 +0200

erAck gravatar image

There are plenty of JSON to CSV converters and vice versa on the net, for example https://json-csv.com/ or http://convertcsv.com/json-to-csv.htm and reverse with https://json-csv.com/reverse or http://convertcsv.com/csv-to-json.htm

If you need something more sophisticated and/or control of the conversion then take a look at the jqtool (https://stedolan.github.io/jq/) and/or csvkit(https://github.com/wireservice/csvkit), both are usually available as package in your favourite Linux distribution, but also available for WIndows. You'll need command line knowledge though but both have a decent documentation and you'll find lots of questions, answers and solutions for example on the stackoverflow site.

edit flag offensive delete link more

Comments

Actually I'm try to keep it stupid proof. I'm trying to build a spreadsheet to take tuner information allow the end user to see all the number and make his/her edits and write back to JSON file so they can import back to the tuner. I need to keep it down to loading a file and saving a file. Skip the python and other stuff because this has to work for both Windows and Linux people both without a lot of programming.

Just need to parse that JSON clip in a spreadsheet and be able to save back. Without python and conversion scripts.

Mopar1973Man gravatar imageMopar1973Man ( 2019-05-19 15:52:39 +0200 )edit
0

answered 2019-05-17 21:09:17 +0200

Ratslinger gravatar image

Hello,

Please see my answer in this post -> Importing CSV and manipulating data with macro.

Not certain of part 2 of the question using any plugin - save back to JSON. Python macro certainly can be done for this.

edit flag offensive delete link more

Comments

This is not based on a server. The JSON file is exported from a vehicle tuner as a file.

All I want to do is read the JSON file populate a spreadsheet and then after editing to save the data back to the JSON file again. I'm not sure how python is going to populate a Calc spreadsheet being it's not on a server but a simple 559 byte file you export from a mobile device.

{"profileName":"Economy Beta","vehicleName":"V2 Dodge 1998-2002","settingsMap":{"125":"103","133":"134","128":"113","127":"109","139":"20","111":"15","19":"0","116":"83","17": "1.5","118":"86","112":"15","22":"40","131":"125","61":"3","115":"82","62":"30","129":"117","126": "106","114":"81","136":"149","121":"92","140":"23","130":"121","119":"88","104":"3200","85": "1200","60":"50","138":"18","113":"80","124":"100","122":"94","135":"144","132":"129","59": "5","15":"8","134":"139","110":"0","120":"90","137":"15","123":"97","18":"100","141":"27","117":"84"}}

Mopar1973Man gravatar imageMopar1973Man ( 2019-05-17 21:43:43 +0200 )edit

Appears comment formatting is off here. (Twas the JSON line)

Linked samples do show access to servers. However, Python is not restricted to that. You write code specific to your needs. I have read and written data using Calc and Python many times.

There are requests in Bugzilla for JSON and Calc but none I can see as implemented.

Ratslinger gravatar imageRatslinger ( 2019-05-17 22:32:27 +0200 )edit

Beyond me. I was just looking for a way to load JSON file in Calc and edit and export back out. I've got no clue about python or writing code that way.

Mopar1973Man gravatar imageMopar1973Man ( 2019-05-18 01:25:51 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-05-17 20:56:18 +0200

Seen: 54 times

Last updated: May 18