public static void main(String[] args) {
String json = "{\"authorList\":[],\"videoDuration\":\"\",\"filterDate\":\"\",\"filterClickDays\":0,\"highDefinitionSrc\":\"\",\"highDefinitionLabel\":\"\",\"lowDefinitionSrc\":\"\",\"lowDefinitionLabel\":\"\",\"linkList\":[],\"schema\":\"{\\r\\n \\\"type\\\": \\\"layout-editor-collapse\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"active\\\": 0,\\r\\n \\\"labelWidth\\\": \\\"140px\\\"\\r\\n },\\r\\n \\\"components\\\": [\\r\\n {\\r\\n \\\"type\\\": \\\"layout-editor-collapse-item\\\",\\r\\n \\\"attributes\\\": {},\\r\\n \\\"components\\\": [\\r\\n {\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者列表\\\",\\r\\n \\\"labelEN\\\": \\\"Author List\\\",\\r\\n \\\"attributePath\\\": \\\"authorList\\\"\\r\\n },\\r\\n \\\"type\\\": \\\"editor-adder\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"labelPosition\\\": \\\"left\\\",\\r\\n \\\"body\\\": [\\r\\n {\\r\\n \\\"type\\\": \\\"editor-author-select\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"asset-type\\\": \\\"authorName\\\",\\r\\n \\\"group-attrs\\\": [\\r\\n \\\"authorPath\\\",\\r\\n \\\"authorAvatarUrl\\\",\\r\\n \\\"authorDescription\\\"\\r\\n ]\\r\\n },\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者名称\\\",\\r\\n \\\"labelEN\\\": \\\"Name\\\",\\r\\n \\\"attributePath\\\": \\\"authorName\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者头像\\\",\\r\\n \\\"labelEN\\\": \\\"Avatar\\\",\\r\\n \\\"attributePath\\\": \\\"authorAvatarUrl\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"图片替代文字\\\",\\r\\n \\\"labelEN\\\": \\\"Image Alt text\\\",\\r\\n \\\"attributePath\\\": \\\"alt\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者描述\\\",\\r\\n \\\"labelEN\\\": \\\"Description\\\",\\r\\n \\\"attributePath\\\": \\\"authorDescription\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者路径\\\",\\r\\n \\\"labelEN\\\": \\\"Author Path\\\",\\r\\n \\\"attributePath\\\": \\\"authorPath\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"当前页面视频时长\\\",\\r\\n \\\"labelEN\\\": \\\"Current Page Video Duration\\\",\\r\\n \\\"attributePath\\\": \\\"videoDuration\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"Filter Date\\\",\\r\\n \\\"attributePath\\\": \\\"filterDate\\\"\\r\\n },\\r\\n \\\"type\\\": \\\"editor-datepicker\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"value\\\": \\\"\\\",\\r\\n \\\"type\\\": \\\"date\\\",\\r\\n \\\"format\\\": \\\"yyyy-MM-dd\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-numeric\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"筛选点击天数\\\",\\r\\n \\\"labelEN\\\": \\\"Filter Click Days\\\",\\r\\n \\\"attributePath\\\": \\\"filterClickDays\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"layout-editor-collapse-item\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"labelPosition\\\": \\\"left\\\"\\r\\n },\\r\\n \\\"components\\\": [\\r\\n {\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"去重链接列表\\\",\\r\\n \\\"labelEN\\\": \\\"Deduplicate Link List\\\",\\r\\n \\\"attributePath\\\": \\\"linkList\\\"\\r\\n },\\r\\n \\\"type\\\": \\\"editor-adder\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"labelPosition\\\": \\\"left\\\",\\r\\n \\\"body\\\": [\\r\\n {\\r\\n \\\"type\\\": \\\"editor-page-select\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"asset-type\\\": \\\"pageUrl\\\"\\r\\n },\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"链接地址\\\",\\r\\n \\\"labelEN\\\": \\\"Link Address\\\",\\r\\n \\\"attributePath\\\": \\\"linkHref\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n }\\r\\n ]\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-asset-select\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"asset-type\\\": \\\"video\\\"\\r\\n },\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"高清晰视频资源地址\\\",\\r\\n \\\"labelEN\\\": \\\"High Definition Video Resource URL\\\",\\r\\n \\\"attributePath\\\": \\\"highDefinitionSrc\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"高清晰类型\\\",\\r\\n \\\"labelEN\\\": \\\"High Definition Label\\\",\\r\\n \\\"attributePath\\\": \\\"highDefinitionLabel\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-asset-select\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"asset-type\\\": \\\"video\\\"\\r\\n },\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"低清晰视频资源地址\\\",\\r\\n \\\"labelEN\\\": \\\"High Definition Video Resource URL\\\",\\r\\n \\\"attributePath\\\": \\\"lowDefinitionSrc\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"低清晰类型\\\",\\r\\n \\\"labelEN\\\": \\\"High Definition Label\\\",\\r\\n \\\"attributePath\\\": \\\"lowDefinitionLabel\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n ]\\r\\n}\",\"schemaVersion\":36,\"schemaCode\":\"huaweitechArticlesTechtalksDetailsTemplate\",\"schemaName\":\"华为技术文章techtalks详情模板\"}";
String result = processJson(json);
System.out.println(result);
}根据上述代码,写一个processJson方法,去除json 字符串中的标签字段,只保留纯文本,应该如何处理
最新发布