#105 parse JSON and YAML
25/01/2023
Free
JSON and YAML are great ways of storing data structures.
You can parse a JSON/YAML file directly with Ruby, or within a Rails application.
You can also WRITE to the file!
Popular usecases:
- parse file and create seed data
- display parsed default data directly in a view (for example FAQ section)
Episode source code:
https://github.com/corsego/105-parse-yaml-json/commit/90282b5468fbfe78bcbb1df29ef91de5eaa160a2
Parse JSON with Ruby on Rails: https://blog.corsego.com/parse-json-with-ruby-on-rails
Parse YAML with Ruby on Rails: https://blog.corsego.com/parse-yaml-yml-with-ruby-on-rails
0:00 incoming JSON and YAML data
0:50 parse YAML with Ruby (no Rails)
2:01 update and save YAML file
3:01 parse JSON with Ruby (no Rails)
3:50 display YAML in Rails controller
6:05 display JSON in Rails controller
6:37 seed database data from datafile
0
Sign in to join the conversation
Recommended based on what you are watching now
![#10 Stripe API - Clear Cart after Checkout, edit Stripe Price](https://superails.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTgzNywicHVyIjoiYmxvYl9pZCJ9fQ==--baf5a455fa38ed846fd0ef66c88d5c903bc506b0/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fbGltaXQiOls0MDAsNjAwXX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--2d7cd3a4d9675c7f4c17dad7856d799792bd3595/maxresdefault.jpg)
15:34
#10 Stripe API - Clear Cart after Checkout, edit Stripe Price
30/03/2021
Free
![#79 Classless CSS frameworks](https://superails.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTgzMSwicHVyIjoiYmxvYl9pZCJ9fQ==--5c379e581b3c76cdb39239617c964295550bf7be/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fbGltaXQiOls0MDAsNjAwXX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--2d7cd3a4d9675c7f4c17dad7856d799792bd3595/maxresdefault.jpg)
06:41
#79 Classless CSS frameworks
16/05/2022
Free