diff options
author | thegeorg <thegeorg@yandex-team.com> | 2023-10-03 11:19:48 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2023-10-03 11:43:28 +0300 |
commit | cda0c13f23f6b169fb0a49dc504b40a0aaecea09 (patch) | |
tree | 26476e92e5af2c856e017afb1df8f8dff42495bf /library/python/json/loads.pyx | |
parent | 4854116da9c5e3c95bb8440f2ea997c54b6e1a61 (diff) | |
download | ydb-cda0c13f23f6b169fb0a49dc504b40a0aaecea09.tar.gz |
Move contrib/tools/jdk to build/platform/java/jdk/testing
Diffstat (limited to 'library/python/json/loads.pyx')
-rw-r--r-- | library/python/json/loads.pyx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/library/python/json/loads.pyx b/library/python/json/loads.pyx new file mode 100644 index 00000000000..82e5c6dce7b --- /dev/null +++ b/library/python/json/loads.pyx @@ -0,0 +1,14 @@ +from libcpp cimport bool + +cdef extern from "library/python/json/loads.h": + object LoadJsonFromString(const char*, size_t, bool internKeys, bool internVals, bool mayUnicode) except + + + +def loads(s, intern_keys = False, intern_vals = False, may_unicode = False): + if isinstance(s, unicode): + s = s.encode('utf-8') + + try: + return LoadJsonFromString(s, len(s), intern_keys, intern_vals, may_unicode) + except Exception as e: + raise ValueError(str(e)) |