joshmfrankel / joshmfrankel.github.io

Blog and Personal site
http://joshfrankel.me
MIT License
2 stars 1 forks source link

Debugging JSON tests #60

Open joshmfrankel opened 1 year ago

joshmfrankel commented 1 year ago

today-i-learned

-"{\"type\":\"modal\",\"clear_on_close\":true,\"callback_id\":\"update_incident\",\"private_metadata\":\"{\\\"channel_id\\\":\\\"C03508FQAAA\\\",\\\"action\\\":\\\"update\\\",\\\"response_url\\\":\\\"https://hooks.slack.com/commands/T0118NNNDFD/4643501750917/QsMN5piojOGMoMpsib87QcDo\\\"}\",\"title\":{\"type\":\"plain_text\",\"text\":\"Update incident\"},\"submit\":{\"type\":\"plain_text\",\"text\":\"Update\"},\"close\":{\"type\":\"plain_text\",\"text\":\"Cancel\"},\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Your form has no fields. Head over to \\u003chttp://localhost:3001/account/form-fields|Form Fields\\u003e to add some.\"}}]}"
+"{\"type\":\"modal\",\"clear_on_close\":true,\"callback_id\":\"update_incident\",\"private_metadata\":\"{\\\"channel_id\\\":\\\"C03508FQAAA\\\",\\\"response_url\\\":\\\"https://hooks.slack.com/commands/T0118NNNDFD/4643501750917/QsMN5piojOGMoMpsib87QcDo\\\",\\\"action\\\":\\\"update\\\"}\",\"title\":{\"type\":\"plain_text\",\"text\":\"Update incident\"},\"submit\":{\"type\":\"plain_text\",\"text\":\"Update\"},\"close\":{\"type\":\"plain_text\",\"text\":\"Cancel\"},\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Your form has no fields. Head over to \\u003chttp://localhost:3001/account/form-fields|Form Fields\\u003e to add some.\"}}]}"


b = "{\"type\":\"modal\",\"clear_on_close\":true,\"callback_id\":\"update_incident\",\"private_metadata\":\"{\\\"channel_id\\\":\\\"C03508FQAAA\\\",\\\"response_url\\\":\\\"https://hooks.slack.com/commands/T0118NNNDFD/4643501750917/QsMN5piojOGMoMpsib87QcDo\\\",\\\"action\\\":\\\"update\\\"}\",\"title\":{\"type\":\"plain_text\",\"text\":\"Update incident\"},\"submit\":{\"type\":\"plain_text\",\"text\":\"Update\"},\"close\":{\"type\":\"plain_text\",\"text\":\"Cancel\"},\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Your form has no fields. Head over to \\u003chttp://localhost:3001/account/form-fields|Form Fields\\u003e to add some.\"}}]}"

a = JSON.parse(a)
b = JSON.parse(b)

# Diff in keys
b.keys - a.keys
#=> []

# Diff in values
b.values - a.values
#=> ["{\"channel_id\":\"C03508FQAAA\",\"response_url\":\"https://hooks.slack.com/commands/T0118NNNDFD/4643501750917/QsMN5piojOGMoMpsib87QcDo\"}"]