Jason, alsoknownasJavaScriptobjectnotation, issimply a datarepresentationformatverysimilartoXMLoryeah, no, it's usedwidelyacrosstheInternetforalmosteverysingle A p I thatyouwillaccess, aswellasBurkeandFIGfilesandthingssuchasgamesintexteditorslikeGSCodeandmany, manyotherplacesthroughoutprogramming.
Also, almosteverysinglemajorlanguagehassomeformoflibraryorbuiltandfunctionalitytoparseJasonstringsintoobjectsorclassesinthatlanguage, whichmakesworkingwithJasondataextremelyeasyinsideof a programminglanguage.
Soit's takenexampleof a userobjectthatwewanttoputatthetoplevelofourJaceonfile, whichwe'regoingtocalluserdotJasontocreateanobjectweneedtouseopeningandclosingcurlybraces.
Thekeymustbesurroundedbydoublequote, followedby a colonandthenthevalueforthatkey.
Andthenifwehavemultiplekeyvaluepairs, weneedcommasseparatingeverysingleoneofourkeyvaluepairssimilarly, tohowwewouldcreateanarrayin a normalprogramminglanguage.
So, forexample, ifouruserhas a namewhichsurroundthatname, keyanddoublequotes, put a semicolonafter.
Andattheendofthatwe'llput a commabecausewehaveotherkeyvaluepairsforuser.
Forexample, ifwewantedtouse a favoritenumberasanotherproperty, we'llputfavoritenumberindoublequotes, followedby a semicolon, andthenputthatusersfavoritenumber.
Then, ifwewantedtouse a Boolean, weuse a commaandthenanotherproperty.
WewouldusehisprogrammerasArchy, put a colon, andthenwehadputeithertrueorfalsewithnoquotesaroundit, tosignifythatthisis a Booleanandnot a string.
Sowewouldputtrueorfalse, dependingonifthatuserwas a programmerornot.
Andthat's howyoureallygetintothepowerofJason, whereyoucanstarttodeeplynestdifferentpropertiesandreallyshow a hierarchyofdataasopposedtojust a flatformoutofdata.
Andyoucanstarttoget a verydeeplymessedit a greatifyoureallywanted.
Thenwejusthavetomakesurethatwedon't put a commaontheverylastpropertyvalue.
Keepairthatwehavecloseitwith a curlybrace.
Andthat's ourfullJasonfilecreated.
NowthatweunderstandwhatJasonisandthisintaxinvolvedwithwritingJason, I'm goingtojumpinto a liveexampleofmewritingJasonfileandthenpartsinthatfileinJavascares.
So I havevisualstudiocodeopen, and I'm insideof a filecalledcosdotJason.
We'regoingtostoreanarrayofdifferentcompanies, andeachofthesecompaniesisgoingtohave a name, numberofemployees, a CEOandtheirratingoutoffive.
Solet's getstartedbyusingarsontextforcreating a ratewhichistouseanopeningandclosingsquarebracketandincitedthisarray.
We'regoingtostoredifferentobjectsSoourfirstobjectisgoingtobeourfirstcompany, which, aswementioned, has a nameandwe'rejustgoingtogivethatcompanynameofBigcorporation.