Skip to content

Conversation

rabidaudio
Copy link

I have a pretty memory-tight application and the parser buffer size of 512 was way overkill for my use-case (the largest individual keys/values are around 20 chars). I'm apparently not the first to have this issue. #19

This PR allows you to override the buffer size, either through build flags or by defining the prop before the library is imported:

#define JSON_PARSER_BUFFER_MAX_LENGTH 128
#include <JsonStreamingParser.h>

I renamed the definition to reduce the chance of conflicts with definitions in other code.

@ircmaxell
Copy link

Note: you'll also need to modify increaseBufferPointer() in JsonStreamingParser.cpp, which also refers to BUFFER_MAX_LENGTH:

void JsonStreamingParser::increaseBufferPointer() {
  bufferPos = min(bufferPos + 1, BUFFER_MAX_LENGTH - 1);
}

@rabidaudio
Copy link
Author

@mrcodetastic
Copy link

Can you raise a pull request for

https://github.com/mrfaptastic/json-streaming-parser2

Because this library isn't maintained anymore it seems .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants