We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.
I've noticed that when iteratively parsing a json stream character by character 'incomplete' floats are 'stepped' over:
import json import jiter obj = {'float': 1.0} obj_json = json.dumps(obj) token_stream = [] sub = '' for c in obj_json: sub += c token_stream.append(sub) for mode in ['trailing-strings', 'on']: for stream in token_stream: parsed = jiter.from_json(stream.encode(), partial_mode=mode) print(f'{mode}: {stream} -> {parsed}') print('\n')
prints the following output:
trailing-strings: { -> {} trailing-strings: {" -> {} trailing-strings: {"f -> {} trailing-strings: {"fl -> {} trailing-strings: {"flo -> {} trailing-strings: {"floa -> {} trailing-strings: {"float -> {} trailing-strings: {"float" -> {} trailing-strings: {"float": -> {} trailing-strings: {"float": -> {} trailing-strings: {"float": 1 -> {'float': 1} trailing-strings: {"float": 1. -> {} trailing-strings: {"float": 1.0 -> {'float': 1.0} trailing-strings: {"float": 1.0} -> {'float': 1.0} on: { -> {} on: {" -> {} on: {"f -> {} on: {"fl -> {} on: {"flo -> {} on: {"floa -> {} on: {"float -> {} on: {"float" -> {} on: {"float": -> {} on: {"float": -> {} on: {"float": 1 -> {'float': 1} on: {"float": 1. -> {} on: {"float": 1.0 -> {'float': 1.0} on: {"float": 1.0} -> {'float': 1.0}
I'd suggest to coerce 1. into the float 1.0 (or expose an option to enable that)
1.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I've noticed that when iteratively parsing a json stream character by character 'incomplete' floats are 'stepped' over:
prints the following output:
I'd suggest to coerce
1.
into the float1.0
(or expose an option to enable that)The text was updated successfully, but these errors were encountered: