Recent

Author Topic: fcl-json: use custom TJsonScanner  (Read 1430 times)

piola

  • Full Member
  • ***
  • Posts: 150
  • Lazarus 2.2, 64bit on Windows 8.1 x64
fcl-json: use custom TJsonScanner
« on: December 18, 2024, 04:50:55 pm »
Hello,

I want to use a custom Json scanner, e.g. for calls to FpJson.GetJson. The easiest thing would be overrinding the TJsonParser constructors and replace the FScanner:=TJSONScanner.Create calls with custom ones. However, unfortunately, the FScanner field is private, so no access possible.

Is there a way to achieve that without having to maintain a complete copy of all fcl-json files?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8790
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: fcl-json: use custom TJsonScanner
« Reply #1 on: December 19, 2024, 04:40:55 am »
From the source, it's currently not possible. You can however copy the whole thing and replace the scanner with your own, replacing the call to SetJSONParserHandler accordingly. This last one doesn't even mandate any parsing interface to be fulfilled, it only asks for a given TStream, output a TJSONData.

 

TinyPortal © 2005-2018