[Development] is it possible to increase the max. document size for the JSON parser?

Thiago Macieira thiago.macieira at intel.com
Tue Aug 6 16:53:22 CEST 2019


On Tuesday, 6 August 2019 04:47:01 PDT René J. V. Bertin wrote:
> Hello,
> 
> I have a 114Mb big JSON file that I'd like to be able to parse but that is
> rejected because of its size.
> 
> Is it possible to rebuild Qt with a larger maximum document size for the
> JSON parser? I found the Value::MaxSize token which is somehow related to
> the too- large error, understand you cannot change that without also
> changing the related bitfield definitions. I haven't yet found a "max
> number of values" parameter so how exactly is the DocumentTooLarge error
> linked to Value::MaxSize ?

It's a structural limit. The maximum size is 128 MB, which is 2^27. The reason 
is in the union right after the maximum size:

class Value
{
public:
    enum {
        MaxSize = (1<<27) - 1
    };
    union {
        uint _dummy;
        qle_bitfield<0, 3> type;
        qle_bitfield<3, 1> latinOrIntValue;
        qle_bitfield<4, 1> latinKey;
        qle_bitfield<5, 27> value;
        qle_signedbitfield<5, 27> int_value;
    };

The solution for this is https://codereview.qt-project.org/265312. Please help 
Ulf finish the porting.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products





More information about the Development mailing list