Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert decimal to float with ijson.items

Tags:

python

ijson

I am reading a big array of JSONS from a file with ijson.items , but numbers are converted to type Decimal.

Example Decimal('14.2')

The documentation says that there is an option use-float = true. But I don't know where to put this option.

Is it possible to use ijson.itemsand obtain floats?

like image 785
Juan Avatar asked Oct 27 '25 03:10

Juan


1 Answers

ijson.items(file, 'your.prefix', use_float=True)
like image 91
GProst Avatar answered Oct 29 '25 17:10

GProst