以下是我想要获取密钥并将其存储在Json
中的array
部分内容。我想显示来自这些键的搜索建议。用户类型p然后显示他1password和所有其他包括p。
allapps
"[{\"[root] StickMount\":287,\"1Password\":610,\"360 Mobile Security Limited\":386,\"360 Security\":387,\"360 Security Lite\":541,\"4shared\":812,\"505 Games Srl\":321,\"8 Ball Pool\":651,\"9apps\":809,\"9apps Inc.\":808,\"aa\":417,\"Adobe\":266,\"Adobe Acrobat Reader\":267,\"Adobe Photoshop Express\":779,\"Adobe Photoshop Lightroom\":778,\"AdWords\":814,\"Agar.io\":717,\"AgileBits\":609,\"AirDroid\":506,\"Alibaba.com Hong Kong Limited\":804,\"AliExpress Shopping App\":805,\"Amazon Kindle\":397,\"Amazon Mobile LLC\":396,\"AMC Security\":607,\"Android Auto\":855,\"Android Pay\":593,\"Android System WebView\":514,\"Android Wear\":849,\"Andrzej Chomiak\":785,\"Angry Birds\":857,\"Angry Birds Action!\":599,\"Apk Extractor\":580,\"Apple Inc.\":661,\"Apple Music\":662,\"AppLock\":451,\"Apus Group\":298,\"APUS Launcher\":299,\"Asphalt 8: Airborne\":306,\"Asphalt Nitro\":549,\"Automattic, Inc\":535,\"Avast Anti-Theft\":827,\"Avast Antivirus & Security\":573,\"Avast Cleanup\":653,\"AVAST Software\":572,\"B612\":582,\"Battery Time Saver\":586,\"Battle Ages\":909,\"Battle Islands\":910,\"BBM\":229,\"BlackBerry Limited\":228,\"Blackmart\":216,\"Blackmart Alpha\":217,\"Blizzard Entertainment, Inc.\":431,\"Boom Beach\":220,\"Brave Frontier\":429,\"Camera 360 Ultimate\":344,\"Camera360 Lite\":842,\"Candy Crush Jelly Saga\":761,\"Candy Crush Saga\":334,\"Candy Crush Soda Saga\":727,\"Casper\":503,\"Casper.io\":502,\"Castle Clash\":461,\"Castle Clash (German)\":460,\"CCleaner\":529,\"Chainfire\":276,\"ChainsDD\":279,\"Cheetah Mobile\":285,\"Cheetah Mobile (AntiVirus & AppLock)\":392,\"Chrome\":223,\"Clash of Clans\":219,\"Clash of Kings\":412,\"Clash of Lords\":464,\"Clash of Lords 2\":462,\"Clash of Lords 2: Clash Divin\":463,\"Clash Royale\":584,\"Clean Master\":286,\"ClockworkMod\":704,\"CM Security Antivirus\":393,\"Com2uS\":466,\"Cortana\":446,\"CSR Racing\":823,\"CSR Racing 2\":822,\"Cyril PREISS\":729,\"Dan The Man\":868,\"Despicable Me\":834,\"DewMobile, Inc.\":510,\"diep.io\":759,\"Dolphin Browser\":516,\"DoMobile Lab\":450,\"Dropbox\":231,\"Dropbox, Inc\":230,\"DU APPS STUDIO\":324,\"DU Battery Saver\":325,\"DU Speed Booster\":328,\"Dubsmash\":448,\"Duolingo\":532,\"Easy Uninstaller\":565,\"ELECTRONIC ARTS\":342,\"Elex Wireless\":411,\"Epic War\":644,\"ES File Explorer (for Cupcake 1.5)\":292,\"ES File Manager File Explorer\":271,\"ES Global\":270,\"Everimaging Ltd.\":624,\"Evernote\":351,\"Evernote Corporation\":350,\"Exploration Lite\":786,\"Facebook\":211,\"Facebook Inc\":210,\"Facebook Lite\":215,\"Facebook Messenger\":212,\"Facebook Pages Manager\":308,\"FarmVille 2: Country Escape\":420,\"FarmVille: Harvest Swap\":421,\"FarmVille: Tropic Escape\":739,\"Field Trip\":689,\"FIFA 15 Ultimate Team\":414,\"FIFA 16\":494,\"FIFA 17 Companion\":793,\"FIFA Mobile Soccer\":765,\"File Manager (File Transfer)\":291,\"Fingersoft\":437,\"Firefox\":251,\"flash\":908,\"Flash Player\":559,\"Forge of Empires\":426,\"Fotor Photo Editor\":625,\"Free Android Tools\":281,\"Frim\":265,\"FrimApp.com\":264,\"Fruit Ninja Free\":481,\"Galaxy Wars\":840,\"Game of War - Fire Age\":471,\"Gameloft\":305,\"Gems of War - Match 3 RPG\":911,\"General Adaptive Apps Pty Ltd\":416,\"Gmail\":225,\"GO Dev Team\":617,\"GO Dev Team @ Android\":295,\"GO Dev Team +\":240,\"GO Keyboard - Emoji, Sticker\":634,\"GO Keyboard - Emoji, Wallpaper\":619,\"GO Keyboard Dev Team\":633,\"GO Launcher\":296,\"GO SMS Pro\":618,\"Google AdSense\":544,\"Google Allo\":757,\"Google Analytics\":675,\"Google Authenticator\":784,\"Google Calendar\":224,\"Google Camera\":691,\"Google Docs\":272,\"Google Drive\":509,\"Google Duo\":751,\"Google Earth\":278,\"Google Inc.\":221,\"Google Keep\":753,\"Google Keyboard\":545,\"Google Messenger\":288,\"Google Photos\":366,\"Google Play Books\":558,\"Google Play Games\":361,\"Google Play Newsstand\":772,\"Google Play Services\":222,\"Google Search App\":248,\"Google Sheets\":274,\"Google Slides\":527,\"Google Text-to-speech\":830,\"Google Translate\":700,\"Google+\":316,\"gumi Inc.\":428,\"Halfbrick Studios\":480,\"Hangouts\":571,\"Hay Day\":404,\"Hearthstone Heroes of Warcraft\":432,\"Hello\":269,\"Hexlock\":488,\"Hill Climb Racing\":438,\"Hola Launcher\":384,\"Holaverse\":383,\"HootanParsa\":852,\"IGG.COM\":459,\"im30.net\":839,\"Imangi Studios\":354,\"imo\":358,\"imo.im\":357,\"Inbox\":500,\"INFOLIFE LLC\":564,\"Ingress\":677,\"Inkwire\":705,\"InnoGames GmbH\":425,\"Instagram\":245,\"IObit Mobile Security\":606,\"J2 Interactive\":473,\"Jetpack Joyride\":871,\"joeykrim\":337,\"JoyCrafter Entertainment\":798,\"Jumobile\":710,\"Kabam\":456,\"Kakao Corporation\":370,\"KakaoTalk\":371,\"Kik\":258,\"Kik Interactive\":257,\"Kiloo\":482,\"King\":333,\"Kingo ROOT\":604,\"Kingosoft Technology Ltd.\":603,\"KingRoot\":568,\"KingRoot Studio\":567,\"Life Bofore Us LLC\":435,\"LINE\":310,\"LINE Corporation\":309,\"LIONMOBI\":339,\"Liquidum Limited\":487,\"Lords Mobile\":846,\"Lowtech Studios\":627,\"Machine Zone, Inc.\":470,\"Madden NFL Mobile\":844,\"Maps\":255,\"MARVEL Contest of Champions\":457,\"Master for Minecraft-Launcher\":796,\"MCPE Master\":795,\"meher\":579,\"Messenger for Pok\\u00e9mon GO\":680,\"Messenger Lite\":825,\"Microsoft Corporation\":362,\"Microsoft Excel\":595,\"Microsoft Office Mobile\":520,\"Microsoft PowerPoint\":597,\"Microsoft Word\":547,\"Minecraft: Pocket Edition Demo\":576,\"Miniclip.com\":650,\"Minions Paradise\\u2122\":736,\"MiXplorer\":905,\"Mobile Motion GmbH\":447,\"Mobile Strike\":645,\"Mobo Live Team\":213,\"Mobogenie Lite\":238,\"Mobogenie Pro\":239,\"Mobogenie.com\":237,\"MoboMarket\":214,\"Mohammad Adib\":693,\"Mojang\":575,\"MORTAL KOMBAT X\":802,\"Mozilla\":250,\"MSQRD\":907,\"MX Player\":474,\"MX Player Pro\":749,\"My Talking Tom\":714,\"NaturalMotionGames Ltd\":821,\"NBA LIVE Mobile\":588,\"Need for Speed\\u2122 No Limits\":746,\"Netflix\":631,\"Netflix, Inc.\":630,\"New IT Solutions\":811,\"Niantic, Inc.\":672,\"Nokia Apps Distribution LLC\":551,\"Nordeus\":376,\"Norton Security and Antivirus\":659,\"NortonMobile\":658,\"Nova Launcher\":409,\"OneDrive\":478,\"Ookla\":816,\"Opera\":253,\"Opera browser - news & search\":664,\"Opera Mini\":254,\"Outfit7\":713,\"Outlook\":363,\"PayPal\":498,\"PayPal Here: Get Paid Anywhere\":744,\"PayPal Mobile\":497,\"Peak Games\":836,\"Perfect Piano\":303,\"Periscope\":374,\"Pet Rescue Saga\":399,\"Phone\":722,\"Phone INFO \\u2605Samsung\\u2605\":832,\"PhotoScan\":864,\"Photoshop Mix\":777,\"PicsArt\":561,\"PicsArt Photo Studio\":562,\"PinGuo Inc\":341,\"Pinterest\":642,\"Pinterest, Inc.\":641,\"Piriform\":528,\"Pixel Launcher\":903,\"Plants vs. Zombies FREE\":343,\"Plants vs. Zombies\\u2122 2\":345,\"Plants vs. Zombies\\u2122 Heroes\":591,\"Play Store\":226,\"Poke Radar for Pokemon GO\":694,\"PokeDetector\":720,\"Pok\\u00e9map Live - Find Pok\\u00e9mon\":733,\"Pok\\u00e9Mesh\":741,\"Pok\\u00e9Mesh - Real time map\":742,\"Pok\\u00e9mon GO\":673,\"Pou\":390,\"Power Clean\":340,\"Prisma\":708,\"Prisma Labs inc.\":707,\"Pushbullet\":524,\"Quickoffice\":519,\"RAR (WinRAR)\":284,\"RARLAB (published by win.rar GmbH)\":283,\"Razer, Inc\":701,\"RazerGo\":702,\"Real Racing 3\":402,\"Retrica\":313,\"Revontulet Soft Inc\":302,\"Rocket VPN\":491,\"Root Checker\":282,\"Root Essentials\":904,\"Rovio Entertainment Ltd.\":598,\"SAND STUDIO\":505,\"Scopely\":669,\"ShadowEinhorn\":679,\"SHAREit\":443,\"SHAREit Technologies Co.Ltd\":442,\"SimCity BuildIt\":819,\"Skiplagged\":732,\"Skype\":247,\"Skype (Rover)\":476,\"Skype for Business\":601,\"Skype WiFi\":789,\"Slack\":770,\"Slack Technologies Inc.\":769,\"slither.io\":628,\"Smart Poke V2\":730,\"Snapchat\":243,\"Snapchat, Inc.\":242,\"Sony Mobile Communications\":774,\"Speedtest.net\":817,\"Spotify Ltd.\":614,\"Spotify Music\":615,\"Star Wars\\u2122: Galaxy of Heroes\":755,\"Street View\":764,\"Subway Surfers\":483,\"Summoners War\":467,\"Super-Bright LED Flashlight\":454,\"Supercell\":218,\"SuperSU\":277,\"SuperThomasLab\":859,\"Superuser\":335,\"Superuser Update Fixer\":336,\"Surpax Inc.\":453,\"SwiftKey\":696,\"SwiftKey Keyboard\":697,\"System app remover\":711,\"Telegram\":485,\"Telegram Messenger LLP\":484,\"Temple Run\":355,\"Temple Run 2\":356,\"Terraria\":322,\"TeslaCoil Software\":408,\"The Cleaner\":490,\"Tinder\":331,\"Titanium Backup\":261,\"Titanium Track\":260,\"Top Eleven\":377,\"Toy Blast\":837,\"True Software Scandinavia AB\":262,\"Truecaller\":263,\"Twitter\":368,\"Twitter, Inc.\":367,\"Uber\":638,\"Uber Technologies, Inc.\":637,\"UC Browser\":235,\"UC Browser HD\":293,\"UC Browser Mini\":236,\"UCWeb Inc.\":234,\"Upwork\":725,\"Upwork Global Inc (formerly oDesk)\":724,\"Venticake Inc.\":312,\"Viber\":233,\"Viber Media S.\\u00e0 r.l\":232,\"Videolabs\":538,\"VLC\":539,\"vndnguyen\":831,\"Walking Dead: Road to Survival\":670,\"Warner Bros. International Enterprises\":801,\"Waze\":655,\"Waze - GPS, Maps & Traffic\":656,\"Waze Rider\":767,\"WeChat\":406,\"WeChat Tencent\":405,\"WhatsApp\":899,\"WhatsApp Inc.\":901,\"WhatsApp Wallpaper\":790,\"WordPress\":536,\"World Warfare\":799,\"Xmodgames\":622,\"Xmodgames Team\":621,\"Xperia Keyboard\":775,\"Yo\":436,\"YouTube\":227,\"YouTube Music\":613,\"Z Launcher Beta\":552,\"Zakeh\":389,\"Zapya\":511,\"Zedge\":647,\"ZEDGE\\u2122 - Ringtones & Wallpapers\":648,\"ZenUI Launcher\":440,}]
答案 0 :(得分:1)
您可以使用Iterator
获取JSONObject
的所有密钥。
String[] allKeys = new String[10];
Iterator<String> keys = yourJSONObject.keys();
int i = 0;
try {
while (keys.hasNext()) {
key = keys.next();
allKeys[i++] = key ;
}
} catch (Exception e) {
e.printStackTrace();
}
这样您就可以获得allKeys
字符串数组