Created a method to get the object directory in json format