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.
pamela rizkDeveloperAsked:
Who is Participating?
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?
0
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??
0
pamela rizkDeveloperAuthor Commented:
sorry to say but still now working please helpp
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

pamela rizkDeveloperAuthor Commented:
please help since i am stuck
0
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

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

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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.