I'm getting System.FormatException: Input string was not in a correct format when running this method.
The values of the fields:
arrayName = "requester";
fieldList = "\"name\" : \"shimshon\""; // "name" : "shimshon"
public override string ToString()
{
var val = string.Format("\"{0}\" : { {1} }", arrayName, fieldList);
return val;
}
the expect result of the method is
"requester" : { "name" : "shimshon" }
What is wrong with this format?
I think you want:
var val = string.Format("\"{0}\" : {{ {1} }}", arrayName, fieldList);
Note the doubled {{ and }} which is the escape sequence necessary to get braces literally into the output.
Try
var val = string.Format("\"{0}\" : {{ {1} }}", arrayName, fieldList);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With