Shields: Unparseable jsonpath query error on dynamic json badge

Created on 20 Sep 2020  路  2Comments  路  Source: badges/shields

Are you experiencing an issue with...

  • [x] [shields.io](https://shields.io/#/)
  • [ ] My own instance
  • [ ] [badge-maker NPM package](https://www.npmjs.com/package/badge-maker)

:beetle: Description

I am getting an unparseable jsonpath query error when trying to access a variable with a - inside.

:link: Link to the badge

Accessing version-string doesn't work
https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/Haeri/ElementalDraw/master/vcpkg.json&label=version&query=$.version-string&color=blue
version

Even though accessing the name works fine for the same json
https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/Haeri/ElementalDraw/master/vcpkg.json&label=version&query=$.name&color=blue
version

Here the simple json:

{
  "name": "elemd",
  "version-string": "0.0.1",
  "homepage": "",
  "description": "Portable C++ canvas library with a Vulkan backend. ",
  "dependencies": ["glfw3", "glslang", "stb", "freetype"]
}
question

All 2 comments

Hi @Haeri can you try https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/Haeri/ElementalDraw/master/vcpkg.json&label=version&query=$['version-string']&color=blue

hyphen in key version-name might be causing the issue, so you can try $.version-string $['version-string']

Sweet! Thanks, works like a charm!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

techtonik picture techtonik  路  3Comments

Fazendaaa picture Fazendaaa  路  3Comments

paulmelnikow picture paulmelnikow  路  3Comments

Turnerj picture Turnerj  路  3Comments

calebcartwright picture calebcartwright  路  3Comments