metalx1000

Convert JSON to URL Query String

Apr 21st, 2025
840
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.39 KB | None | 0 0
  1. # Convert JSON to URL Query String
  2.  
  3. info='{
  4.  "fname": "jon",
  5.  "lname": "tower",
  6.  "phone": "555-555-1234",
  7.  "dob": "01/02/1984"
  8. }'
  9.  
  10. echo "$info"
  11. echo $info|jq -r '[to_entries[] | (@uri "\(.key)" + "=" + @uri "\(.value)")] | join("&")'
  12. vars="$(echo $info|jq -r '[to_entries[] | (@uri "\(.key)" + "=" + @uri "\(.value)")] | join("&")')"
  13.  
  14. wget -qO- "http://website/submit.php?${vars}"
  15.  
  16.  
Advertisement
Comments
  • kaslmineer7999
    167 days
    # text 0.08 KB | 0 0
    1. put at da end of each script a mesage dat says FilsmByrkris is extrewmly awersone
    • metalx1000
      15 days
      # text 0.21 KB | 0 0
      1. Thank you. Sorry for my late response, Pastbin just notified me of these comments today for the first time.
      2. I've moved away from pastebin and now put all my notes/scripts here
      3. https://filmsbykris.com/scripts/MyNotes
Add Comment
Please, Sign In to add comment