将json-object解析为几个块

时间:2017-12-20 07:43:56

标签: json regex

我需要使用正则表达式将json-object解析为少数json-subobject。输入是json-object接收的,例如:

[{
"customerId": 906366,
"subscriberId": 1231244,
"realTimeStatusId": 100,
"realTimeStatusDate": "2017-08-04T09:27:39"
}, {
"customerId": 906235,
"subscriberId": 1231244,
"realTimeStatusId": 101,
"realTimeStatusDate": "2017-08-04T09:27:39"
}, {
"customerId": 906235,
"subscriberId": 1231243,
"realTimeStatusId": 100,
"realTimeStatusDate": "2017-08-04T08:27:39"
}]

我需要换几次。 第一:

{
"customerId": 906366,
"subscriberId": 1231244,
"realTimeStatusId": 100,
"realTimeStatusDate": "2017-08-04T09:27:39"
 }

第二

{
"customerId": 906235,
"subscriberId": 1231244,
"realTimeStatusId": 101,
"realTimeStatusDate": "2017-08-04T09:27:39"
}

等 我怎么用正则表达式来做呢?

1 个答案:

答案 0 :(得分:0)

您可以使用以下正则表达式:

\{[^}]+\}

regex101

上测试

https://regex101.com/r/PnnqHv/1