How do I parse this JSON using VB.net? -


so, i'm working on school project, , i'm trying figure out best way deal data file contains pretty large amount of json objects. know basics of vb.net, basic event handling, etc.

i know basics of designing structures, , stuff that, need figure out how parse , create list of objects 5mb json file contains entries such following:

{     "air elemental":{         "layout":"normal",         "name":"air elemental",         "manacost":"{3}{u}{u}",         "cmc":5,         "colors":[             "blue"         ],         "type":"creature — elemental",         "types":[             "creature"         ],         "subtypes":[             "elemental"         ],         "text":"flying",         "power":"4",         "toughness":"4",         "imagename":"air elemental"     },     "ancestral recall":{         "layout":"normal",         "name":"ancestral recall",         "manacost":"{u}",         "cmc":1,         "colors":[             "blue"         ],         "type":"instant",         "types":[             "instant"         ],         "text":"target player draws 3 cards.",         "imagename":"ancestral recall"     },     "animate artifact":{         "layout":"normal",         "name":"animate artifact",         "manacost":"{3}{u}",         "cmc":4,         "colors":[             "blue"         ],         "type":"enchantment — aura",         "types":[             "enchantment"         ],         "subtypes":[             "aura"         ],         "text":"enchant artifact\nas long enchanted artifact isn't creature, it's artifact creature power , toughness each equal converted mana cost.",         "imagename":"animate artifact"     } } 

if of assistance, or sort of point me in right direction, i'd appreciate it. think part that's throwing me off each card name key in itself, , of card's data value associated name "key"...

in case hardly matters how many there because structured same way:

public class spell     public property layout string     public property name string     public property manacost string     public property cmc integer     public property colors string()     public property type string     public property types string()     public property subtypes string()     public property text string     public property power string     public property toughness string     public property imagename string end class 

i have no idea data represents, looks fantasy game. when deserialized (i used newtonsoft), end dictionary of spells key being "air elemental" , "animate artifact" etc. takes 1 line of code:

dim jstr string = whereever    dim myspells = jsonconvert.deserializeobject(of dictionary(of string, spell))(jstr) 

using net javascriptserializer same:

dim jss new javascriptserializer dim myspells = jss.deserializeobject(jstr) 

you can use http://jsonutils.com/, or paste special in vs, parse structures (classes, really) need like. however, pays use brain , @ them. robot create 3 classes json , class container hold them. if there 100 of them needlessly long.

since each item identical , json 1 class can used each. since json formatted accommodate, standard net dictionary works fine.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -