asp Json

dear all

please i need help i am stuck for three days

 Dim sJSON1 As String = "{'ConditionParameter' : {'DocType':'6', 'Reference_Num':'573942', 'StkMethod':'LOAD_H' }}"
no problem when using the below command :
dim ArrayList = new ArrayList
 For Each Dict As KeyValuePair(Of String, Object) In mydictionnary 'ex :ID1, arraylist
            Array_List.Add(TryCast(Dict.Value, ArrayList))
        Next

Array_List(0) is not nothing

but

Dim sJSON1 As String = "{'ConditionParameter' : [{'DocType':'6', 'Reference_Num':'573942', 'StkMethod':'LOAD_H' }]}"
no problem when using the below command :
dim ArrayList = new ArrayList
 For Each Dict As KeyValuePair(Of String, Object) In mydictionnary 'ex :ID1, arraylist
            Array_List.Add(TryCast(Dict.Value, ArrayList))
        Next

Array_List is nothing

so in brief if no "[" in the json i have an error please help asap.
LVL 1
pamela rizkDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Your code is incomplete, thus it makes no sense:

You've defined sJSON1, but you don't use it at all. What does mydictionnary contain? Who does it declaration look like? Why transforming it into an ArrayList?
pamela rizkDeveloperAuthor Commented:
what i am trying to say is that i have ajson

Dim sJSON1 As String = "{'ConditionParameter' : [{'DocType':'6', 'Reference_Num':'573942', 'StkMethod':'LOAD_H' }]}"
i need to deserialize it intoa  dataset how to do i??
pamela rizkDeveloperAuthor Commented:
sorry to say but still now working please helpp
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

pamela rizkDeveloperAuthor Commented:
please help since i am stuck
ste5anSenior DeveloperCommented:
E.g. using Newtonsoft.Json (use nuget to install that pakage):

 
Imports Newtonsoft.Json

Module Module1

    Sub Main()

        Dim jsonString As String = "{'ConditionParameter' : [{'DocType':'6', 'Reference_Num':'573942', 'StkMethod':'LOAD_H' }]}"
        Dim parameters As DataSet = JsonConvert.DeserializeObject(Of DataSet)(jsonString)
        Dim parametersTable As DataTable = parameters.Tables("ConditionParameter")

        Console.WriteLine(parametersTable.Rows.Count)

        For Each row As DataRow In ParametersTable.Rows
            Console.WriteLine(row("DocType") + " - " + row("Reference_Num") + " - " + row("StkMethod"))
        Next row

        Console.WriteLine("Done.")
        Console.ReadLine()

    End Sub

End Module

Open in new window

pamela rizkDeveloperAuthor Commented:
is there any alternative for newtonsoft?
ste5anSenior DeveloperCommented:
It's a standard and it's simple..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.