【发布时间】:2019-09-26 18:59:30
【问题描述】:
我有一个本地 JSON 文件。我需要根据日期解析该文件中的数据。
JSON 文件中的数据格式:
{"01-01-2017":{"color":"white","message":"The Octave Day of Christmas Solemnity of the Blessed Virgin Mary, the Mother of God Lectionary: 18"},"02-01-2017":{"color":"white","message":"Memorial of Saints Basil the Great and Gregory Nazianzen, Bishops and Doctors of the Church Lectionary: 205"},"03-01-2017":{"color":"white","message":"Christmas Weekday Lectionary: 206"},"04-01-2017":{"color":"white","message":"Memorial of Saint Elizabeth Ann Seton, Religious Lectionary: 207"},"05-01-2017":{"color":"white","message":"Memorial of Saint John Neumann, Bishop Lectionary: 208"},"06-01-2017":{"color":"white","message":"Christmas Weekday Lectionary: 209"},"07-01-2017":{"color":"white","message":"Christmas Weekday Lectionary: 210"},"08-01-2017":{"color":"white","message":"The Epiphany of the Lord Lectionary: 20"},"09-01-2017":{"color":"white","message":"The Baptism of the Lord Lectionary: 21"},"10-01-2017":{"color":"darkseagreen","message":"Tuesday of the First Week in Ordinary Time Lectionary: 306"}}
根据我需要解析相应消息的日期。我该怎么做?
【问题讨论】:
-
如果您在控制台中打印变量
jsonString,您会看到什么?在调用JObject.Parse(jsonString);之前做 -
我测试了您提供的代码,没有错误,它运行良好。能否提供代码示例供我测试?
-
@pinedax 问题出在我的 JSON 文件上。它包含一些特殊字符。
-
@WendyZang 问题出在我的 JSON 文件上。它包含一些特殊字符。
标签: json parsing xamarin.forms