jqplay에서 다음 행의 형식을 테스트 할 때 어떤 이유로 명령 줄에서 실행했을 때와 다른 결과가 나오는 이유는 무엇입니까? 당신이 jq playground,로는 어떻게해야 정확히 형식을 것을 덤프 경우 내가 그것을 할 방법jq가 내 JSON 내에서 키를 재정렬합니다.
My original data looks as such:
{"type":"user.list","users":[{"type":"user","id":"57db1b1b9jdjd84f99b977785ba","user_id":"janwjf3sqdditwn7c7","anonymous":false,"email":"[email protected]","phone":null,"name":"Joe Smith","pseudonym":null,"avatar":{"type":"avatar","image_url":null},"app_id":"b5vkddxvop","companies":{"type":"company.list","companies":[]},"location_data":{"type":"location_data","city_name":"Murfreesboro","continent_code":"NA","country_name":"United States","latitude":35.8896,"longitude":-86.3166,"postal_code":"37130","region_name":"Tennessee","timezone":"America/Chicago","country_code":"USA"},"last_request_at":1478624249,"last_seen_ip":"69.139.122.123","created_at":1473977115,"remote_created_at":1466313380,"signed_up_at":1466313380,"updated_at":1480970142,"session_count":1,"social_profiles":{"type":"social_profile.list","social_profiles":[]},"unsubscribed_from_emails":false,"user_agent_data":"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko","tags":{"type":"tag.list","tags":[{"type":"tag","id":"587061","name":"Mixpanel Import - 2016-09-15 21:25:08 UTC"}]},"segments":{"type":"segment.list","segments":[{"type":"segment","id":"581a048c4ad88d6b458198d7"},{"type":"segment","id":"5845cd57c91b1fe3e440032b"},{"type":"segment","id":"5845cab9d951b43e7d33d2f7"}]},"custom_attributes":{"mixpanel_id":"1556710d919339-0beb72f2966b408-69581467-cff8c-1556710d91a54b","claimCount":"2","memberType":"claimant"}}],"scroll_param":"56386a4d-743b-470a-ae9f-848b991e0ccc"}
{"type":"user","id":"57db1b1b9jdjd84f99b977785ba","user_id":"janwjf3sqdditwn7c7","anonymous":false,"email":"[email protected]","phone":null,"name":"Joe Smith","pseudonym":null,"avatar":{"type":"avatar","image_url":null},"app_id":"b5vkddxvop","companies":{"type":"company.list","companies":[]},"location_data":{"type":"location_data","city_name":"Murfreesboro","continent_code":"NA","country_name":"United States","latitude":35.8896,"longitude":-86.3166,"postal_code":"37130","region_name":"Tennessee","timezone":"America/Chicago","country_code":"USA"},"last_request_at":1478624249,"last_seen_ip":"69.139.122.123","created_at":1473977115,"remote_created_at":1466313380,"signed_up_at":1466313380,"updated_at":1480970142,"session_count":1,"social_profiles":{"type":"social_profile.list","social_profiles":[]},"unsubscribed_from_emails":false,"user_agent_data":"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko","tags":{"type":"tag.list","tags":[{"type":"tag","id":"587061","name":"Mixpanel Import - 2016-09-15 21:25:08 UTC"}]},"segments":{"type":"segment.list","segments":[{"type":"segment","id":"581a048c4ad88d6b458198d7"},{"type":"segment","id":"5845cd57c91b1fe3e440032b"},{"type":"segment","id":"5845cab9d951b43e7d33d2f7"}]},"custom_attributes":{"mixpanel_id":"1556710d919339-0beb72f2966b408-69581467-cff8c-1556710d91a54b","claimCount":"2","memberType":"claimant"}}
내가 데이터를 방법을 정확하게 재구성 될 것입니다.
jqplay에 대한 링크이동하여 단순히 필터에이를 입력하고 컴팩트 한 출력을 클릭하여, yourselft에 대한 참조 :
.users[]
그러나 어떤 이유로
내가 명령 줄에서 이것을 실행curl https://api.example.com/users/scroll -u 'dG9rOjg4YmUxMzr4XzJmNzZfNDkwY3934jU2X2mrM2MxZGEzYWI2MzoxOjA=': -H 'Accept:application/json'| jq -c '.users[]'
{"custom_attributes":{"memberType":"claimant","claimCount":"2","mixpanel_id":"1556710d919339-0beb72f2966b408-69581467-cff8c-1556710d91a54b"},"segments":{"segments":[{"id":"581a048c4ad88d6b458198d7","type":"segment"},{"id":"5845cd57c91b1fe3e440032b","type":"segment"},{"id":"5845cab9d951b43e7d33d2f7","type":"segment"}],"type":"segment.list"},"tags":{"tags":[{"name":"Mixpanel Import - 2016-09-15 21:25:08 UTC","id":"587061","type":"tag"}],"type":"tag.list"},"user_agent_data":"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko","unsubscribed_from_emails":false,"social_profiles":{"social_profiles":[],"type":"social_profile.list"},"session_count":1,"updated_at":1480970142,"signed_up_at":1466313380,"pseudonym":null,"name":"Joe Smith","phone":null,"email":"[email protected]","anonymous":false,"user_id":"janwjf3sqdditwn7c7","id":"57db1b1b9jdjd84f99b977785ba","type":"user","avatar":{"image_url":null,"type":"avatar"},"app_id":"b5vkddxvop","companies":{"companies":[],"type":"company.list"},"location_data":{"country_code":"USA","timezone":"America/Chicago","type":"location_data","city_name":"Murfreesboro","continent_code":"NA","country_name":"United States","latitude":35.8896,"longitude":-86.3166,"postal_code":"37130","region_name":"Tennessee"},"last_request_at":1478624249,"last_seen_ip":"69.139.122.123","created_at":1473977115,"remote_created_at":1466313380}
어떤 당신이 말할 수있는, jqplayground 기능에서 어떻게 나왔는지와 전혀 다릅니다. 문제를 더욱 혼란스럽게 만들기 위해 다른 누군가가 그것을 실행하고 올바르게 형식을 지정했습니다. 그것의 위에, 약 1 주 전에, 그것은 나를 위해 잘 일했다.
jq를 제거하고 다시 설치해 보았습니다. 어떻게 든 도움이된다면 우분투 14.04.2 LTS (GNU/Linux 3.13.0-51-generic x86_64)에서 실행하고 있습니다.
도움이 될 것입니다.
그래서 "잘못 되었나요?" 예상대로 포맷되지 않은 방법은 무엇입니까? –
@ Jeff - 주문 키 문제입니다. – peak
@ wizkids121 - 사용중인 jq 버전을 지정하십시오. – peak