Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Log JSON data to flattened field #485

Answered by tdsrhh
tdsrhh asked this question in Q&A
Discussion options

You must be logged in to vote

I found a solution for this, Maybee the best but I works for my cases ...

    protected override void WriteJsonProperty(string name, object value, ref string precedingDelimiter, TextWriter output)
    {
        // to support flattened type ...
        if (value is ScalarValue && (value as ScalarValue).Value is string && ((value as ScalarValue).Value as string).Contains("\""))
        {
            output.Write(precedingDelimiter);
            output.Write("\"");
            output.Write(name);
            output.Write("\":");
            output.Write((value as ScalarValue).Value);
            precedingDelimiter = ",";
            return;
        }

        base.WriteJsonProperty(name, val…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by tdsrhh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant