课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

今天就开通帐号,24,100 门业界名师课程任您挑!

Validate JSON

Validate JSON

- One of the difficult things about writing JSON is making sure that what you're writing is correct. And you oftentimes need a validator to look through the JSON code that you've written and make sure that everything is in line. The JSON light package provides Validate for just this purpose. And let's take a look at how that works. First I need some JSON code, of course. So I'm going to create some JSON just by running that line. And you can see over in the environment window that I now have a vector called someJSON. And let's go ahead and validate that. And what I get back is the value true. And what that indicates is that my JSON works perfectly. So let's go in and change something that we know is an error. I'm going to add a extra curly brace and then redefine someJSON. And I'm going to hit validate again and we'll see what happens. So let's go down and take a look at the console where the…

内容