rainmeter-jsonparser icon indicating copy to clipboard operation
rainmeter-jsonparser copied to clipboard

Unable to parse JSON from weather API

Open mallardduck opened this issue 2 years ago • 3 comments

Per the example from the readme, I'm trying to parse JSON data from weather API. I can verify the API is getting data and populating an initial [Weather] data field. The issue seems to happen when I try to parse that data for any internal value.

Here is the code in question:

[Weather]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=1200
Url=https://api.openweathermap.org/data/2.5/weather?lat=#Lat#&lon=#Lon#&appid=#ApiKey#&units=#units#
RegExp=(?siU)^(.*)$

[MeasureWeather.Location]
Measure=Plugin
Plugin=JsonParser.dll
Source=[Weather]
Query=name

I've tried to use the following permutations of query values:

  • Query=name
  • Query="name"
  • Query=".name"
  • Query="$name"

No matter what I try the location ends up empty/blank in the rainmeter log debugger.

The error in the logs is:

Error reading JToken from JsonReader. Path '', line 0, position 0. (Gemini\Sidebars\pollux.ini - [MeasureWeather.Location])

mallardduck avatar May 02 '22 19:05 mallardduck

Actually - I just switched from the 1.1 version down to 1.0 and the snippet above started to work. The error still shows up in the logs, but I get a functional value.

mallardduck avatar May 02 '22 19:05 mallardduck

1.1 definitely had some issues. I hope to get back to it some time. Can I assume this issue is resolved?

e2e8 avatar May 12 '22 04:05 e2e8

~Hiya @e2e8 - yes I think this can be closed as resolved.~

~However I want to clarify as I may have simply had missing dependencies. At one point before I got 1.0 working I did try to compile myself and poke around. In the process I did install more .NET framework components via Window's "Add or Remove Features" options. Yesterday I tried again with 1.1 and things did seem to work for me which got me thinking about those steps I did before trying 1.0.~

~So it seems most likely the root issue here was user error due to me not having the necessary .NET installed on windows 11. Maybe at the very least adding a note about the dependency would be good if I'm correct that adding those .NET frameworks to windows fixed it.~

UPDATE (12/22/22): Recently my main SSD died on my PC so I had to reinstall everything. Upon doing this I tried to reproduce my install as noted in this comment. However even after installing .NET framework stuff via windows add/remove features tool it didn't work with V 1.1. So I reverted to 1.0 and it seems to work fine.

mallardduck avatar May 12 '22 12:05 mallardduck