Feature: JSON parse options
Currently we just use Klaxon to read JSON using the default settings. We should allow users to change Klaxon settings.
From another side, need to do it without expanding any Klaxon API in our public API if it changes in the future
That's probably why it was hidden
Some proxies for basic options will be enough, probably?
probably yes. For advanced stuff users can simply parse it using their own parser, export to string and feed it to DF again
@Jolanrensen is it possible to disable parsing of JSONs and read them as Strings?
Definitely! It depends a bit from where you want to disable this. If you're reading from CSV, for instance, you can supply a colTypes = mapOf("yourColName" to ColType.String), this will skip parsing completely and makes sure a column remains String.
The second way to do it is a bit less obvious, but also works well. JSON is parsed to DataRow/DataFrame, meaning, if you add parserOptions = ParserOptions(skipTypes = setOf(typeOf<AnyFrame>(), typeOf<AnyRow>())), the result of parsing will never contain a DataRow or DataFrame so JSON will remain String. This can also be done globally by calling DataFrame.parser.addSkipType(...).
Definitely! It depends a bit from where you want to disable this. If you're reading from CSV, for instance, you can supply a
colTypes = mapOf("yourColName" to ColType.String), this will skip parsing completely and makes sure a column remainsString.The second way to do it is a bit less obvious, but also works well. JSON is parsed to DataRow/DataFrame, meaning, if you add
parserOptions = ParserOptions(skipTypes = setOf(typeOf<AnyFrame>(), typeOf<AnyRow>())), the result of parsing will never contain a DataRow or DataFrame so JSON will remain String. This can also be done globally by callingDataFrame.parser.addSkipType(...).
Thank you! Second approach looks interesting.