Repository navigation
Parsing of JSON data starting with "[" #80
|
I was not able to parse a JSON file containing a single array of objects, i.e., having "[" as its first element. Is there a way to do it, or are these files not supported? |
Answered by
jasperhabicht
Nov 11, 2025
Replies: 1 comment 1 reply
|
Thank you for your input! It is probably a bit hidden in the manual, but you can always address the whole JSON string (at the root level, so to say) with the pseudo key \documentclass{article}
\usepackage{jsonparse}
\begin{document}
\JSONParse{\myjson}{
[ "foo", "bar", "baz" ]
}
\JSONParseArrayUse{\myjson}{.}{, }
\newcommand{\myfunction}{\emph{\JSONParseArrayValue}, }
\JSONParseArrayMapFunction{\myjson}{.}{\myfunction}
\JSONParseArrayMapInline{\myjson}{.}{
\JSONParseValue{\myjson}{[#1]}
}
\end{document}Is this what you're aiming for? |
1 reply
Answer selected by
mkaut
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for your input! It is probably a bit hidden in the manual, but you can always address the whole JSON string (at the root level, so to say) with the pseudo key
.. In this case, you can make use of this as follows:Is this what you're aiming for?