views:

26

answers:

1

Hi , I have to pass my Json data in a particular format. My app is coded in vb.

The following is my code :

 Dim jsonObject As New Json.JsonObject
    jsonObject.Item("count") = New Json.JsonNumber("0")
     jsonObject.Item("data") = New Json.JsonArray("")
    **jsonObject.Item("success") = New Json.JsonString("True")**

    The Problem lies in the line :

jsonObject.Item("success") = New Json.JsonString("True") . The error message being shown is " Type 'Jayrock.Json.JsonString' has no constructors."

Just to add i have imported the associated libraries .

What should I do to tackle this problem ??

+1  A: 

Try simply like this:

Dim jsonObject As New Json.JsonObject  
jsonObject.Item("count") = 0  
jsonObject.Item("data") = New Json.JsonArray()  
jsonObject.Item("success") = "True"

In other words, you can use primitive types like string and integer as values.

Atif Aziz