Skip to content

why does the root element in JsonConfigurationFileParser must be an object? #56638

Answered by LeaFrock
yoziv asked this question in Q&A
Discussion options

You must be logged in to vote

why does that restriction exist ?

It's just a convention of design. As the codes(VisitElement, VisitValue) below the line you show informs, the parser accepts the premise that the json content should be a json object rather than other json types.

how can i use this json file as a config

Though you cannot control the files, you can check and rewrite the content of each json file into a new one, then let the parser use it.

{"MySettings":[ { "version": 1, "handlerEnvironment": { "logFolder": ".\\logs", "configFolder": ".\\RuntimeSettings", "statusFolder": ".\\Status", "heartbeatFile": ".\\Status\\HeartBeat.Json" } } ]}

Or you may have to write your own parser and replace the default one …

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@LeaFrock
Comment options

@yoziv
Comment options

@davidfowl
Comment options

@LeaFrock
Comment options

@yoziv
Comment options

Answer selected by yoziv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants