19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:32:02 +01:00
parent 62d197ac8b
commit 184bb0e321
667 changed files with 691406 additions and 239886 deletions

View file

@ -0,0 +1,17 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
def extend_serialized_json(json: str, key_value_pairs: list) -> str:
"""
Add key-value pairs to a serialized JSON object string.
value should be already serialized.
"""
# avoid copying strings as much as possible for performance reasons
parts = [json.removesuffix('}')]
if json != '{}':
parts.append(',')
for i, (key, value) in enumerate(key_value_pairs):
parts.extend([f'"{key}":', value])
if i != len(key_value_pairs) - 1:
parts.append(',')
parts.append('}')
return ''.join(parts)