0
도와주세요. Java에서 다음 json 배열과 같이 만들고 싶습니다.자바에서 2 차원 json 배열을 만드는 방법
var tasks = {
data:[
{id:1, text:"Project #1",start_date:"31-03-2013", duration:3, progress: 1, open: true},
{id:2, text:"Task #1", start_date:"03-04-2013", duration:5, progress: 1, open: true, parent:1},
{id:3, text:"Task #2", start_date:"02-04-2013", duration:7, progress: 0.5, open: true, parent:1},
{id:4, text:"Task #2.1", start_date:"03-04-2013", duration:2, progress: 1, open: true, parent:3},
{id:5, text:"Task #2.2", start_date:"04-04-2013", duration:3, progress: 0.8, open: true, parent:3},
{id:6, text:"Task #2.3", start_date:"05-04-2013", duration:4, progress: 0.2, open: true, parent:3}
],
links:[
{id:1, source:1, target:2, type:"1"},
{id:2, source:1, target:3, type:"1"},
{id:3, source:3, target:4, type:"1"},
{id:4, source:4, target:5, type:"0"},
{id:5, source:5, target:6, type:"0"}
]
};
감사합니다.
을 사용했다. 하지만 물론 가능하며 자바에서 JSON 라이브러리를 사용하는 방식에 따라 다릅니다. – fge
json-lib-2.4-jdk15.jar을 사용하고 있습니다. 사실 내가 게시 한 부분은 javascript에 있으며 java 액션에서 Json 객체를 생성해야하고 return 객체는 tasks 변수에 할당되어야합니다. – AK1
유효한 json이지만 여기에 2 차원 배열이 없습니다. – Simulant