using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
public class MyApiResponseClass
[JsonProperty("custom_attributes")]
public List<CustomAttribute> CustomAttributes { get; set; } = new();
public class CustomAttribute
[JsonProperty("attribute_code")]
public string AttributeCode { get; set; } = string.Empty;
public object Value { get; set; }
public static void Test()
var responseContent = GetJson();
var response = JsonConvert.DeserializeObject<MyApiResponseClass>(responseContent);
var newJson = JsonConvert.SerializeObject(response, Formatting.Indented);
Console.WriteLine("Re-serialized {0}:", response);
Console.WriteLine(newJson);
static string GetJson() =>
"attribute_code": "required_options",
"attribute_code": "category_ids",
"attribute_code": "has_options",
"attribute_code": "an_object",
public static void Main()
Console.WriteLine("Environment version: {0} ({1}), {2}", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription , Environment.Version, Environment.OSVersion);
Console.WriteLine("{0} version: {1}", typeof(JsonSerializer).Namespace, typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");