nolanmaris 0 Posted 12 hours ago Hello When working with REST APIs in Delphi; I often encounter large JSON responses that can slow down processing & even cause memory issues. Parsing such responses using TJSONObject or TJSONParser sometimes results in performance bottlenecks, especially when handling deeply nested structures or high-volume data from services like Amazon or Google APIs.😇 I’m looking for the best way to handle these large JSON responses efficiently. Would streaming the JSON instead of loading it all at once be a better approach? Are there lightweight libraries or techniques that help optimize performance while keeping memory usage low? 🤔Additionally, how can I extract only the needed data from a large JSON response without parsing the entire object?🤔 If anyone has experience dealing with similar issues, I’d love to hear about recommended practices. Thank you !!🙂 Share this post Link to post
Die Holländer 68 Posted 11 hours ago (edited) Some databases support JSON tables where you can insert JSON strings and query them with normal SQL and is VERY fast. Google for example "MSSQL database JSON" >>Additionally, how can I extract only the needed data from a large JSON response without parsing the entire object? You can exactly do this with the database, because you have to create a kind of mapping to use the SQL and you can map only the fields that you need.. Edited 10 hours ago by Die Holländer Share this post Link to post
Zoran Bonuš 12 Posted 4 hours ago In such situations I use JSONReader instead: https://docwiki.embarcadero.com/CodeExamples/Sydney/en/RTL.JSONReader It's less convenient, but much more efficient when "sequential" processing of the json is possible. Share this post Link to post