Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. (require 'request)
  2. (require 'json)
  3. (require 'cl)
  4.  
  5. (setq json-string "{"1": [{"id": 2,"attribute": "salutation","displayName": "Salutation","category": 1},{"id": 4,"attribute": "middlename","displayName": "Middle Name","category": 1},{"id": 6,"attribute": "suffix","displayName": "Suffix","category": 1},{"id": 8,"attribute": "city","displayName": "City","category": 1},{"id": 9,"attribute": "state","displayName": "State","category": 1},{"id": 11,"attribute": "email","displayName": "Email","category": 1},{"id": 12,"attribute": "telephone","displayName": "Telephone","category": 1},{"id": 10,"attribute": "zipCode","displayName": "Zip Code","category": 1},{"id": 13,"attribute": "telephoneExtension","displayName": "Telephone Extension","category": 1},{"id": 7,"attribute": "streetAddress","displayName": "Street Address","category": 1},{"id": 3,"attribute": "firstName","displayName": "First Name","category": 1},{"id": 1,"attribute": "fullName","displayName": "Full Name","category": 1},{"id": 5,"attribute": "lastName","displayName": "Last Name","category": 1},{"id": 14,"attribute": "notes","displayName": "Notes","category": 1}],"2": [{"id": 15,"attribute": "name","displayName": "Name","category": 2},{"id": 16,"attribute": "address","displayName": "Address","category": 2},{"id": 17,"attribute": "phone","displayName": "Phone","category": 2},{"id": 18,"attribute": "email","displayName": "email","category": 2},{"id": 19,"attribute": "url","displayName": "URL","category": 2}],"3": [{"id": 20,"attribute": "name","displayName": "Name","category": 3},{"id": 21,"attribute": "address","displayName": "address","category": 3},{"id": 22,"attribute": "county","displayName": "County","category": 3},{"id": 23,"attribute": "state","displayName": "State","category": 3},{"id": 24,"attribute": "zipcode","displayName": "Zip Code","category": 3},{"id": 25,"attribute": "pin","displayName": "PIN","category": 3},{"id": 26,"attribute": "longitude","displayName": "Longitude","category": 3},{"id": 27,"attribute": "latitude","displayName": "Latitude","category": 3}]")
  6.  
  7. (setq tester (json-read-from-string json-string))
  8.  
  9. ;;(message "%s" tester)
  10. ;; This looks like: ((1 . [((id . 2) (attribute . salutation) (displayName . Salutation) (category . 1)) ((id . 4) (attribute . middlename) (displayName . Middle Name) (category . 1)) ((id . 6) (attribute . suffix) (displayName . Suffix) (category . 1)) ((id . 8) (attribute . city) (displayName . City) (category . 1)) ((id . 9) (attribute . state) (displayName . State) (category . 1)) ((id . 11) (attribute . email) (displayName . Email) (category . 1)) ((id . 12) (attribute . telephone) (displayName . Telephone) (category . 1)) ((id . 10) (attribute . zipCode) (displayName . Zip Code) (category . 1)) ((id . 13) (attribute . telephoneExtension) (displayName . Telephone Extension) (category . 1)) ((id . 7) (attribute . streetAddress) (displayName . Street Address) (category . 1)) ((id . 3) (attribute . firstName) (displayName . First Name) (category . 1)) ((id . 1) (attribute . fullName) (displayName . Full Name) (category . 1)) ((id . 5) (attribute . lastName) (displayName . Last Name) (category . 1)) ((id . 14) (attribute . notes) (displayName . Notes) (category . 1))]) (2 . [((id . 15) (attribute . name) (displayName . Name) (category . 2)) ((id . 16) (attribute . address) (displayName . Address) (category . 2)) ((id . 17) (attribute . phone) (displayName . Phone) (category . 2)) ((id . 18) (attribute . email) (displayName . email) (category . 2)) ((id . 19) (attribute . url) (displayName . URL) (category . 2))]) (3 . [((id . 20) (attribute . name) (displayName . Name) (category . 3)) ((id . 21) (attribute . address) (displayName . address) (category . 3)) ((id . 22) (attribute . county) (displayName . County) (category . 3)) ((id . 23) (attribute . state) (displayName . State) (category . 3)) ((id . 24) (attribute . zipcode) (displayName . Zip Code) (category . 3)) ((id . 25) (attribute . pin) (displayName . PIN) (category . 3)) ((id . 26) (attribute . longitude) (displayName . Longitude) (category . 3)) ((id . 27) (attribute . latitude) (displayName . Latitude) (category . 3))]))
  11.  
  12. (message "%s" (assoc '1 tester))
  13. ;; => nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement