Parse JSON

Discussions about using 3rd party extension with OpenOffice.org
Post Reply
bdemarchi
Posts: 1
Joined: Sat Mar 24, 2018 3:42 pm

Parse JSON

Post by bdemarchi »

Hi All,

Just sharing a plugin that allows you to work with JSON on Calc.

I could not find a way to do that with OpenOffice 4.1.1.

This plugin allows you to specify a JSON url (API provided by many sites) and query through it using a query format similar to XPath.
It adds a function to Calc named PARSEJSON(url, query).
Read the Readme.txt if you wants to undestand how to use it.

https://github.com/bdemarchi/parseJSON

Regards

Edit:
As pointed out there is another extension that works with JSON.
I went to https://extensions.openoffice.org but could not find that extension there and that is why I decided to implement something.
Also, there is LibreOffice and there is OpenOffice, two different products. I am using OpenOffice, I don't see any reason to go look at LibreOffice extensions and try to use them on OpenOffice. I haven't seen anything while using OpenOffice that clearly states we can use LibreOffice plugins.
I still have to add this extension to the OpenOffice extension site, will update this post once that is done.
Last edited by bdemarchi on Sat Mar 24, 2018 5:23 pm, edited 3 times in total.
OpenOffice 4.1.1
Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Parse JSON

Post by Villeroy »

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Parse JSON

Post by Villeroy »

IMHO, the "getrest" extension is more efficient because it allows you to download the data with one GET formula and then analyse the downloaded string by means of dozends of function calls to =com.github.binnarywolf.LibreOfficeGetRestPlugin.parseJSON().

Your function =com.github.fbdm.parseJSON.parseJSON() triggers one download with every function call. It can not parse the content of a cell.

Both add-ins return numeric strings which is pointless in a arithmetic software.
LibreOffice has a NUMBERVALUE function which allows you to specify the decimal separator: =NUMBERSTRING(A1;".")
The workaround for OpenOffice reads the second char of a known decimal fraction and replaces it within the given string with the actually wanted decimal before converting the string to value: =VALUE(SUBSTITUTE("138.98" ; "." ; MID(PI() ; 2 ; 1))). In case of a comma locale, the point in 138.98 will be replaced with the comma borrowed by the PI() function. Instead of PI() you could also use any other fraction like 1/2

Oh, and the locale for Brazilian language is pt-BR. Language=pt, country=BR
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply