【发布时间】:2020-12-02 09:07:52
【问题描述】:
我使用 JSON Auto 在数据库中的表中创建了一个类型为 varchar(max) 的列,以便该表的所有列都存储为 JSON,包括外键。
现在我创建的我的 Json 看起来像这样:
{
"widgetConfiguration": {
"id": 1,
"name": "sfgg",
"is_cache_enabled": null,
"xparam": null,
"xparamvalue": null,
"yparam": null,
"yparamvalue": null,
"operation": null,
"fromdate": "2020-04-13T00:00:00",
"todate": null,
"categorizeon": null,
"remarks": "t1",
"limit1": null,
"filter": null,
"description": "",
"add_to_summary": "#EA1136",
"summaryname": "#E19452",
"colour": "card t-4",
"subtitle_alias": null,
"x_axis_alias": null,
"y_axis_alias": null,
"summary_subtitle_alias": null,
"is_deleted": false,
"sub_x_axis": null,
"sub_x_axis_alias": null,
"category": "domain-category",
"imgsrc": ".\/assets\/image\/Cyber_governence.png",
"count_category": null,
"count_column": null,
"count_category_column": null,
"drilldown": null,
"y2axis": null,
"dualaxis": null,
"threshold_field": null,
"createdby": null,
"createdon": null,
"modifiedby": "afgafg",
"modifieddate": "2020-04-13T00:00:00",
"showOnCategories": null,
"priority": 1,
"link": null,
"percent_stacked": null,
"y1axistype": null,
"y2axistype": null,
"note": null,
"drilldown_title1": null,
"drilldown_title2": null,
"drilldown_type": "Normal",
"severity": null,
"context": null,
"records_type": null,
"charttype":"{\"id\":1,\"charttype\":\"line\",\"description\":\"Line chart\",\"context\":2,\"default_config\":\"{\\\"chart\\\":{\\\"type\\\":\\\"line\\\",\\\"zoomType\\\":\\\"xy\\\"},\\\"title\\\":null,\\\"legend\\\":{\\\"layout\\\":\\\"vertical\\\",\\\"align\\\":\\\"right\\\",\\\"verticalAlign\\\":\\\"middle\\\"},\\\"plotOptions\\\":{\\\"series\\\":{\\\"dataLabels\\\":{\\\"enabled\\\":true}}}}\",\"createdby\":null,\"createdon\":null,\"updatedby\":null,\"updatedon\":null,\"is_deleted\":false}}}
从数据库中读取时如何转换成java的域?
我尝试过使用 Gson 但没有用! 数据数据 = new Gson().fromJson(json, Data.class);
我也尝试使用 Parser No USe :(请帮帮我!
【问题讨论】:
-
我已经尝试过对象映射器,但它没有工作! @Marcin Krysiak
标签: java sql json database jsonconvert