Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified JsonPreprocessor/JsonPreprocessor.pdf
Binary file not shown.
57 changes: 57 additions & 0 deletions packagedoc/additional_docs/The JSONP format.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,63 @@ \section{Python inline code}
% "element" : <<eval import itertools; combined_list=list(itertools.combinations([1, 2, 3], 2)); element=combined_list[0]>>
% C:\workplace\ROBFW\components\python-jsonpreprocessor\test\testfiles\jpp-test_config_2108.jsonp

% --------------------------------------------------------------------------------------------------------------

\newpage

\section{Special characters within key names}

Basically, the \textbf{JsonPreprocessor} considers the JSON naming convention for key names. Within JSONP files allowed is what JSON allows,
but with the following limitation: The JSONP format extends the JSON format with some features using square, curly and angle brackets as syntax elements:
\pcode{[}, \pcode{]}, \pcode{\{}, \pcode{\}}, \pcode{<}, \pcode{>}. \textbf{It is urgently recommended not to use these brackets inside key names!}

This JSONP code:

\begin{pythoncode}
{
"[" : 1,
"B" : ${[}
}
\end{pythoncode}

causes:

\begin{pythonlog}
Error: 'Invalid expression found: '${[}' - The brackets mismatch!!!'!
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are too many exclamation marks in the error message. It should be either 'The brackets mismatch!' or 'The brackets mismatch!!!' but not both.

Suggested change
Error: 'Invalid expression found: '${[}' - The brackets mismatch!!!'!
Error: 'Invalid expression found: '${[}' - The brackets mismatch!'

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Son,

maybe a small maintenance activity for you.

\end{pythonlog}

All other special characters can be used immediately:

\begin{pythoncode}
{
"$" : 1,
"B" : ${$}
}
\end{pythoncode}

Result:

\begin{pythonlog}
DotDict({'$': 1, 'B': 1})
\end{pythonlog}

Strings are handled as raw strings. Therefore, masking has no effect:

\begin{pythoncode}
{
"\\$" : 1,
"B" : ${\\$}
}
\end{pythoncode}

The backslashes are part of the key name:

\begin{pythonlog}
DotDict({'\\$': 1, 'B': 1})
\end{pythonlog}

\textit{The masking requires two backslashes! A single backslash will cause a JSON syntax error!}


% --------------------------------------------------------------------------------------------------------------