我正在尝试为Django中的模型提供初始数据。但是当我尝试运行django.core.serializers.base.DeserializationError: Problem installing
fixture '/home/location/fixtures/initial_data.json':
Expecting property name enclosed in double quotes: line 7 column 10 (char 119)
时,我收到以下错误:
[
{
"model": "location.zipcode",
"pk": 1,
"fields": {
"zipcode": 79936,
}
},
{
"model": "location.zipcode",
"pk": 2,
"fields": {
"zipcode": 90011,
}
}
]
我的灯具或初始数据是这样的:
zipcode
我在Zipcode模型中将public decimal? FyTotalCost { get; set; }
作为IntegerField。
将不胜感激。
答案 0 :(得分:3)
尾随逗号在JSON中无效,请删除它们 这会给:
[
{
"model": "location.zipcode",
"pk": 1,
"fields": {
"zipcode": 79936
}
},
{
"model": "location.zipcode",
"pk": 2,
"fields": {
"zipcode": 90011
}
}
]