Skip to content

Valid JSONPath crashes Rainmeter #8

Description

@idefy

First off, thanks a lot for this plugin, so much better than using regex, it should be part of rainmeter by default ;)

The plugin crashes rainmeter quite easily. For example, if you receive a non valid JSON, it crashes rainmeter.

But the main issue here, is the fact that it crashes with valid JSONPath

Using this path it works:
Query="$.countries[?(@.country == 'Canada')]"

But using this one, which is valid, it will crash rainmeter:
Query="$.countries[?(@.country == 'Canada')].holidays[?(@.date >= '2023-05-02')]"

Here is the full ini file:
`[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
size=8
padding=10

[MeaJSON]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=600
Url="file://#@#holidays.json"
RegExp=(?siU)^(.*)$
StringIndex=1
DynamicVariables=1

[MeaCountry]
Measure=Plugin
Plugin=JsonParser.dll
Source=[MeaJSON]
Query="$.countries[?(@.country == 'Canada')].holidays[?(@.date >= '2023-05-02')]"

[MetStyle]
AntiAlias=1
FontFace=Segoe UI Light
FontColor=255,255,255,255
FontSize=#size#
X=#padding#
Y=0R
Text=%1

[MetTest]
Meter=String
MeterStyle=MetStyle
MeasureName=MeaCountry`

And here is the json used:
{ "countries": [ { "country": "Canada", "holidays": [ { "date": "2023-01-02", "name": "New Year's Day", "group": ["AB","BC","MB","NB","NL","NS","NT","NU","ON","PE","QC","SK","YT"] }, { "date": "2023-02-20", "name": "Family Day", "group": ["AB","BC","NB","ON","SK"] }, { "date": "2023-02-20", "name": "Luis Riel Day", "group": ["MB"] }, { "date": "2023-02-20", "name": "Islander Day", "group": ["PE"] }, { "date": "2023-02-20", "name": "Heritage Day", "group": ["NS"] }, { "date": "2023-04-07", "name": "Good Friday", "group": ["All"] }, { "date": "2023-04-22", "name": "Victoria Day / National Patriot's Day", "group": ["All"] }, { "date": "2023-06-19", "name": "Juneteenth", "group": ["All"] }, { "date": "2023-06-26", "name": "Quebec National Day", "group": ["QC"] }, { "date": "2023-07-03", "name": "Canada Day", "group": ["All"] }, { "date": "2023-07-03", "name": "Canada Day", "group": ["All"] }, { "date": "2023-08-07", "name": "Civic Holiday", "group": ["AB","BC","ON","SK"] }, { "date": "2023-08-07", "name": "New Brunswick Day", "group": ["NB"] }, { "date": "2023-09-04", "name": "Labour Day", "group": ["All"] }, { "date": "2023-09-29", "name": "National Day for Truth and Reconciliation", "group": ["All"] }, { "date": "2023-09-29", "name": "Thanksgiving Day", "group": ["AB","BC","MB","NL","NS","NT","NU","ON","QC","YT"] }, { "date": "2023-10-10", "name": "Rememberance Day", "group": ["All"] }, { "date": "2023-12-25", "name": "Christmas Day", "group": ["All"] }, { "date": "2023-12-26", "name": "Boxing Day", "group": ["All"] }, { "date": "2024-01-01", "name": "New Year's", "group": ["All"] } ] } ] }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions