pj_feed(&parser, doc, doc_len);
pj_feed_end(&parser);
pj_poll(&parser, tokens, tokens_len);
Ensure this code works as most developers would expect. I.e. tokens will be filled with all tokens according to doc up to the final PJ_END (or PJ_ERR if applicable).