jcrist / msgspec

A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
https://jcristharif.com/msgspec/
BSD 3-Clause "New" or "Revised" License
2.01k stars 59 forks source link

Is there a way to stop parsing long lists of JSON objects when an object with a certain property value is found #702

Open christianplatta1012 opened 3 weeks ago

christianplatta1012 commented 3 weeks ago

Question

Hi, I have a JSON document that has as a property a list of objects which is quite long and costly to parse. I only need one element of this list and I think it would speed things up if msgspec had a way to just stop parsing the list, when a specific object is found. Is there any callback/hook in msgspec where I can implement such a behaviour? I think it is similar to Contstaints but with the stopping aspect when the constraint is matched.

Best regards, Christian