-2
{
    "name": "group1",
    "userData": "user-provided data attached to the person group.",
    "recognitionModel": "recognition_03"
}

If I need to pass the above body in a http client call how do I format that in C#?

Filburt
  • 17,626
  • 12
  • 64
  • 115
Shri
  • 3
  • 2

1 Answers1

-1

Maybe you find your anwser here:

public void JsonStringExample()
{
    string example1 = @"{
    ""name"": ""group1"",
    ""userData"": ""user-provided data attached to the person group."",
    ""recognitionModel"": ""recognition_03""
}";

    string example2 = "{"
        + " \"name\": \"group1\","
        + " \"userData\": \"user-provided data attached to the person group.\","
        + " \"recognitionModel\": \"recognition_03\""
        + "}";

    var stringBuilder = new StringBuilder();

    stringBuilder.AppendLine("{");
    stringBuilder.AppendLine("  \"name\": \"group1\",");
    stringBuilder.AppendLine("  \"userData\": \"user-provided data attached to the person group.\",");
    stringBuilder.AppendLine("  \"recognitionModel\": \"recognition_03\"");
    stringBuilder.AppendLine("}");

    string example3 = stringBuilder.ToString();

    string exmaple4 = String.Join(
        "\r\n",
        new string[]
        {
            "{",
            "   \"name\": \"group1\",",
            "   \"userData\": \"user-provided data attached to the person group.\",",
            "   \"recognitionModel\": \"recognition_03\"",
            "}"
        }
    );
}
nitr0n
  • 26
  • 6