Skip to content

Instantly share code, notes, and snippets.

@romanejaquez
Last active February 28, 2022 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romanejaquez/bedcdb934e46afc038f73a5f4bd6a0af to your computer and use it in GitHub Desktop.
Save romanejaquez/bedcdb934e46afc038f73a5f4bd6a0af to your computer and use it in GitHub Desktop.
import 'dart:convert';
void main() {
var json = '''{
"projects":[
{
"projectId":3,
"projectName":"Complexe hotelier croisette",
"workflow":"en cours",
"realCalendars":[
{
"id":29,
"start":1630590443000,
"end":1648475243000,
"type":0,
"remark":null,
"status":0,
"calendarId":null
}
],
"scheduledCalendars":[
{
"id":30,
"start":1630590443000,
"end":1646059643000,
"type":0,
"remark":null,
"status":0,
"calendarId":null
}
],
"lastPlanningModif":1639320443000,
"planned":164,
"actual":142,
"remaining":25,
"resourceTaskNumber":1,
"projectTaskNumber":18,
"leaderId":8,
"resourceIds":[
8,
7,
6
],
"dashbordField":3,
"dashbordTendency":1,
"weatherComments":[
{
"message":"weather 5",
"date":1645195643000,
"source":1,
"taskId":0,
"projectId":3,
"authorId":8,
"messageId":31,
"messageParentId":32
},
{
"message":"weather 6",
"date":1643813243000,
"source":1,
"taskId":0,
"projectId":3,
"authorId":8,
"messageId":33,
"messageParentId":34
},
{
"message":"weather 7",
"date":1642776443000,
"source":1,
"taskId":0,
"projectId":3,
"authorId":7,
"messageId":35,
"messageParentId":36
}
],
"projectComments":[
{
"message":"Time 3",
"date":1642776443000,
"source":4,
"taskId":3789,
"authorId":7,
"messageId":37,
"messageParentId":38
},
{
"message":"Time 4",
"date":1639838843000,
"source":4,
"taskId":3876,
"projectId":3,
"authorId":8,
"messageId":39,
"messageParentId":40
},
{
"message":"Time 5",
"date":1638888443000,
"source":2,
"taskId":3258,
"projectId":3,
"authorId":8,
"messageId":41,
"messageParentId":42
}
]
},
{
"projectId":2,
"projectName":"Festival de la moutarde de Dijon",
"workflow":"objectif",
"realCalendars":[
{
"id":23,
"start":1682689643000,
"end":1696686443000,
"type":0,
"remark":null,
"status":0,
"calendarId":null
}
],
"scheduledCalendars":[
{
"id":24,
"start":1682689643000,
"end":1696686443000,
"type":0,
"remark":null,
"status":0,
"calendarId":null
}
],
"lastPlanningModif":1646059643000,
"planned":150,
"actual":0,
"remaining":150,
"resourceTaskNumber":2,
"projectTaskNumber":10,
"leaderId":4,
"resourceIds":[
4,
6,
7,
8
],
"dashbordField":4,
"dashbordTendency":2,
"weatherComments":[
{
"message":"weather 4",
"date":1674744443000,
"source":1,
"taskId":0,
"projectId":1,
"authorId":4,
"messageId":25,
"messageParentId":26
}
],
"projectComments":[
]
},
{
"projectId":1,
"projectName":"Red Is Dead",
"workflow":"en cours",
"realCalendars":[
{
"id":9,
"start":1642430843000,
"end":1669387643000,
"type":0,
"remark":null,
"status":0,
"calendarId":null
}
],
"scheduledCalendars":[
{
"id":10,
"start":1642430843000,
"end":1666705643000,
"type":0,
"remark":null,
"status":0,
"calendarId":null
}
],
"lastPlanningModif":1645109243000,
"planned":280,
"actual":58,
"remaining":222,
"resourceTaskNumber":5,
"projectTaskNumber":36,
"leaderId":4,
"resourceIds":[
4,
5,
6
],
"dashbordField":2,
"dashbordTendency":3,
"weatherComments":[
{
"message":"weather 1",
"date":1645800443000,
"source":1,
"taskId":0,
"projectId":1,
"authorId":4,
"messageId":11,
"messageParentId":12
},
{
"message":"weather 2",
"date":1643986043000,
"source":1,
"taskId":0,
"projectId":1,
"authorId":4,
"messageId":13,
"messageParentId":14
},
{
"message":"weather 3",
"date":1643122043000,
"source":1,
"taskId":0,
"projectId":1,
"authorId":4,
"messageId":15,
"messageParentId":16
}
],
"projectComments":[
{
"message":"Time 1",
"date":1642862843000,
"source":4,
"taskId":1234,
"projectId":1,
"authorId":5,
"messageId":17,
"messageParentId":18
},
{
"message":"Time 2",
"date":1642258043000,
"source":4,
"taskId":1235,
"projectId":1,
"authorId":5,
"messageId":19,
"messageParentId":20
},
{
"message":"Task 1",
"date":1641826043000,
"source":2,
"taskId":1234,
"projectId":1,
"authorId":5,
"messageId":21,
"messageParentId":22
}
]
}
],
"avatars":[
{
"resourceId":8,
"idSource":81,
"resourceName":"Alain Martoni",
"trigram":"AMO",
"imgBase64":""
},
{
"resourceId":4,
"idSource":41,
"resourceName":"Odile Deray",
"trigram":"ODE",
"imgBase64":""
},
{
"resourceId":7,
"idSource":71,
"resourceName":"Patrick Bialès",
"trigram":"PBI",
"imgBase64":" "
},
{
"resourceId":5,
"idSource":51,
"resourceName":"Serge Karamazov",
"trigram":"SKA",
"imgBase64":""
},
{
"resourceId":6,
"idSource":61,
"resourceName":"Simon Jérémi",
"trigram":"SJE",
"imgBase64":""
}
]
}''';
//print(json);
var decodedJSON = jsonDecode(json);
var decodedJSON = jsonDecode(json);
print(decodedJSON['projects'].length);
print(decodedJSON['projects'][0]['projectName']);
print(decodedJSON['avatars'].length);
print(decodedJSON['avatars'][0]['resourceName']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment