On 10/29/2017 09:21 PM, Paul Spooren wrote: > Hi all, > > I'm currently trying to use jshn.sh but it changes the data and makes it > unusable. > > Below an example: > > root@LEDE:~# json_string="{ \"foo-bar\": 10 }" > root@LEDE:~# echo $json_string > { "foo-bar": 10 } > root@LEDE:~# json_init > root@LEDE:~# json_load "$json_string" > root@LEDE:~# json_dump > { "foo_bar": 10 } > > Expected would be the same output as input. Is this a bug or a feature? > > Context: > > Running snapshot build. I'm trying to use rpcd-mod-packagelist [1] but > as e.g. "kmod-r8169" becomes "kmod_r8169" it's useless. > > Best, > > Paul Spooren > > [1]: > https://github.com/openwrt/packages/tree/master/utils/rpcd-mod-packagelist
This is definitely a bug in jshn.sh (or possibly a "known limitation" to keep the code simple, as shell variable names can't contain dashes). It should be possible to fix this in jshn with some clever escaping of keys - at least for such "simple" special characters (without looking into it in detail, I assume other unusual characters that aren't allowed in shell variable names are also an issue; supporting the full range of unicode might need more work, or entail a prohibitive performance penalty.) It might actually be much easier to fix the concrete issue by rewriting rpcd-mod-packagelist in C (as I suggested in [2]). Matthias [2] https://github.com/openwrt/packages/pull/5037
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev