【发布时间】:2016-12-20 17:29:56
【问题描述】:
我正在尝试将数据存储在我从 SQL 服务器检索的数组中,他们有什么方法可以完成它吗?
这里是我要动态生成的示例数组:
var movies = [
{ "rank": 1, "rating": 9.2, "year": 1994, "title": "The Shawshank Redemption" },
{ "rank": 2, "rating": 9.2, "year": 1972, "title": "The Godfather" },
{ "rank": 3, "rating": 9, "year": 1974, "title": "The Godfather: Part II" },
{ "rank": 4, "rating": 8.9, "year": 1966, "title": "Il buono, il brutto, il cattivo." },
{ "rank": 5, "rating": 8.9, "year": 1994, "title": "Pulp Fiction" },
{ "rank": 6, "rating": 8.9, "year": 1957, "title": "12 Angry Men" },
{ "rank": 7, "rating": 8.9, "year": 1993, "title": "Schindler's List" },
{ "rank": 8, "rating": 8.8, "year": 1975, "title": "One Flew Over the Cuckoo's Nest" },
{ "rank": 9, "rating": 8.8, "year": 2010, "title": "Inception" },
{ "rank": 10, "rating": 8.8, "year": 2008, "title": "The Dark Knight" }
]
【问题讨论】:
-
要在 c# 中读取/创建 json 数据,请查看 json.net 库。 json.codeplex.com
标签: javascript c# sql-server json asp.net-mvc