- Created
JsonExample.java
and broke down how JSON looks and how it is structured. - JSON is based on Key Value pairs
- Objects are represented by curly brackets
{}
- Arrays are represented by square brackets
[]
- Downloading someone else's code. In this case it's within our Spring-Boot Maven project (Jackson databind).
- Task: Take a Java Object and convert it into a JSON String and then visa versa
- Used Jackson databind to perform the local lifecycle of a JSON String, modify the JSON, and ouput the JSON String
- Learned to pass data from a web request, using Postman
- Put
@RequestParam
's within thecreatePerson
class.- Made
gender
optional by adding@RequestParam(required = false)
- Made
- Status: 200 OK
- Doing it this way we sent
name
,age
, andgender
via Query Params through the ULR - Doing this exposes our data
- Pros: Quick and easy, stateless, and there's no need for session management
- Cons: Security risks, data size limitations, caching issues, and unpleasant user experience
- Removed the
@RequestParam
annotations within thecreatePerson
class - Class still successfully runs and returns us our object as it did before within the URL
- Feature of doing it this way is that you can not specify required fields.
- Doing it this way, none of the fields within the
createPerson
class are required. - So if you leave out
age
it's totally fine and returnsage
as null
- Doing it this way, none of the fields within the
- Status: 200 OK
- Learning the difference between sending data via URL and sending data within the Body of the request via POST
- GET Request: Getting data from the server to HTML
- POST Request: Sending data from HTML to the server (using the Body of the Post request to send the data)
- Sending path variables through GET request using Postman
- Come back to
- Went to Alpha Vantage to play with their free API Key
- Reviewed their documentation