0
私はJSON入力を持っています。私はすべてのタイムスタンプ(createdDate、modifiedDate)をルビの時間に変換したいと思います。それ、どうやったら出来るの?私は私がCreatedDateにしてmodifiedDateのために別途のように2に変換し、[OK]午前方法が、くぼみの仕事Ruby:指定されたjson入力のタイムスタンプを日付時刻に変換する
characterList.each { |char| DateTime.strptime(char.try(:getEditInfo).try(:getCreatedDate),%s) }
{"characterList":
[
{"editInfo":
{"createdBy": "testname",
"createdDate": 1503137795000,
"modifiedBy": "testname",
"modifiedDate": 1503137795000},
"charInfo":
{"charid": "3434",
"charDesc": "3434",
"status": "ON"}
},
{"editInfo":
{"createdBy": "testname",
"createdDate": 1503137795000,
"modifiedBy": "testname",
"modifiedDate": 1503137795000},
"charInfo":
{"charid": "3434 6",
"charDesc": "43dfdf",
"status": "ON"}
},
{"editInfo":
{"createdBy": "testname",
"createdDate": 1503137795000,
"modifiedBy": "testname",
"modifiedDate": 1503137795000},
"charInfo":
{"charid": "4hr_SLA",
"charDesc": "sd",
"status": "ON"}
},
{"editInfo":
{"createdBy": "testname",
"createdDate": 1503137795000,
"modifiedBy": "testname",
"modifiedDate": 1503137795000},
"charInfo":
{"charid": "aaaaaaaaaa",
"charDesc": "asdfaadsf asdfasdf asdf",
"status": "ON"}
},
{"editInfo":
{"createdBy": "testname",
"createdDate": 1503137795000,
"modifiedBy": "testname",
"modifiedDate": 1503137795000},
"charInfo":
{"charid": "abababab",
"charDesc": "abababababab",
"status": "ON"}
}
]}
下回ってみました。しかし、イムは、1行のソリューションを探して