creation of sorted json object for notes