>데이터 베이스 >MySQL 튜토리얼 >string-新手求解 java 如何从一串字符串中提取关键字,并存入mysql

string-新手求解 java 如何从一串字符串中提取关键字,并存入mysql

WBOY
WBOY원래의
2016-06-06 09:35:271763검색

mysqlstringjava

我从txt文档中读取了大概几万行的字符串,并存入string数组中,每个数组里的内容大概如下
{"gps":{"type":"gps","Lon":116.34948495921601,"status":"available","Lat":39.9621098626166},"time":"2015-11-11 19:24:57+0800","wifi":[{"ssid":"TP-LINK_514","mac":"88:25:93:69:36:d5","dbm":-43},{"ssid":"LiebaoFree150","mac":"5e:4b:d6:d5:b1:31","dbm":-56},{"ssid":"TP-LINK_5G_514","mac":"88:25:93:69:36:d4","dbm":-51},{"ssid":"10-331","mac":"1c:7e:e5:55:22:b6","dbm":-82},{"ssid":"1%ts","mac":"fc:d7:33:7f:51:d8","dbm":-77},{"ssid":"BUPT-dot1x","mac":"d8:c7:c8:02:a1:19","dbm":-85},{"ssid":"516NB","mac":"fc:d7:33:7f:e9:dc","dbm":-70},{"ssid":"Kevin","mac":"f4:b7:e2:b7:0e:25","dbm":-86},{"ssid":"ChinaNet","mac":"2e:4b:d6:ab:5e:2b","dbm":-62},{"ssid":"517","mac":"fc:d7:33:7f:50:30","dbm":-79},{"ssid":"OP","mac":"36:de:1a:71:82:0c","dbm":-78},{"ssid":"BUPT-1","mac":"d8:c7:c8:02:a1:18","dbm":-89},{"ssid":"360WiFi-414","mac":"8c:a9:82:00:8d:03","dbm":-71},{"ssid":"TP-LINK 414","mac":"80:89:17:fd:8e:82","dbm":-82},{"ssid":"TP-LINK_L","mac":"fc:d7:33:80:08:ea","dbm":-90},{"ssid":"211_Class8_SICE_Building5","mac":"ec:88:8f:43:33:d4","dbm":-91},{"ssid":"TP-LINK_1303","mac":"fc:d7:33:80:09:6c","dbm":-87}],"cell":[{"connected":true,"mnc":"46001","cell_type":"gsm_uni","dbm":-79,"m":"one","networktype":"UMTS","cid":7089899,"lac":41052}]}

请问我该用什么方法,把其中每个{}内的内容提取出来,并按照ssid,mac,dbm 分别存入mysql中
而且每串字符串中,{}的数目不固定
谢谢

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.