To convert a boolean to Json Boolean in C# and VB.NET you can use the following snippet.

Sample C#

public static string ToJson(bool inputVal)
{
	return inputVal ? "true" : "false";
}

Sample VB.NET

Public Shared Function ToJson(inputVal As Boolean) As String
	Return If(inputVal, "true", "false")
End Function

One thought on “How to convert a boolean to Json Boolean in C# and VB.NET”

Leave a Reply