from_json: Support function to normalize key names

When a JSON document contains key names containing colons or other
special characters that are not valid in Zeek identifiers, from_json()
cannot be used to parse such input.

This change allows a customizable normalization function.

Closes #3142.
This commit is contained in:
Arne Welzel 2023-06-21 11:03:28 +02:00
parent 3a8b299c35
commit 480d52ca1f
14 changed files with 102 additions and 29 deletions

4
NEWS
View file

@ -31,6 +31,10 @@ New Functionality
the break statement within ``assertion_failure()`` or ``assertion_result()``
allows to suppress the default message.
- The ``from_json()`` function now takes an optional key_func argument to
normalize JSON object key names. This can be useful if the keys in a JSON
object are not valid Zeek identifiers or reserved keywords.
Changed Functionality
---------------------