AnsweredAssumed Answered

difference in json response

Question asked by hdalang on Dec 15, 2015
I have created a json response in alfresco for my project which is basically return the path of the folder then paste it in the url and then do action, my problem is that when I tasted my code with freemarker project.get.html.ftl, and it's working ok but when I taste it with my application using project.get.json.ftl, it showed me an error, my problem basically in the url, it should be /Company%20Home/ but what's happening is that /company_home/ and the difference in three words, the C & H are small letter and the space is _, I don't know from where this happened but I checked my code and I cleared cache and did what ever you think of and it's not working, but the weird thing it's working when I use project.get.html.ftl, so basically this my json response that comes from alfresco server:

{
"FolderDetails":[
{
"No":"\/alfresco\/images\/icons\/space-icon-default.gif",
"Name":"Faculty of Arts",
"Path":"\/alfresco/service/digirepo/content?guest=true&pathUrl=\/Company Home\/Guest Home\/Digital Repository\/Faculties/Faculty of Arts",
"Size":"3"
},
{
"No":"\/alfresco\/images\/icons\/space-icon-default.gif",
"Name":"Faculty of Computer Science",
"Path":"\/alfresco/service/digirepo/content?guest=true&pathUrl=\/Company Home\/Guest Home\/Digital Repository\/Faculties/Faculty of Computer Science",
"Size":"4"
},
{
"No":"\/alfresco\/images\/icons\/space-icon-default.gif",
"Name":"Faculty of Economics",
"Path":"\/alfresco/service/digirepo/content?guest=true&pathUrl=\/Company Home\/Guest Home\/Digital Repository\/Faculties/Faculty of Economics",
"Size":"3"
},
{
"No":"\/alfresco\/images\/icons\/space-icon-default.gif",
"Name":"Faculty of Education",
"Path":"\/alfresco/service/digirepo/content?guest=true&pathUrl=\/Company Home\/Guest Home\/Digital Repository\/Faculties/Faculty of Education",
"Size":"3"
},
{
"No":"\/alfresco\/images\/icons\/space-icon-default.gif",
"Name":"Faculty of Engineering",
"Path":"\/alfresco/service/digirepo/content?guest=true&pathUrl=\/Company Home\/Guest Home\/Digital Repository\/Faculties/Faculty of Engineering",
"Size":"4"
},
{
"No":"\/alfresco\/images\/icons\/space-icon-default.gif",
"Name":"Faculty of Science",
"Path":"\/alfresco/service/digirepo/content?guest=true&pathUrl=\/Company Home\/Guest Home\/Digital Repository\/Faculties/Faculty of Science",
"Size":"6"
},
{
"No":"\/alfresco\/images\/icons\/space-icon-default.gif",
"Name":"Faculty of Sharia",
"Path":"\/alfresco/service/digirepo/content?guest=true&pathUrl=\/Company Home\/Guest Home\/Digital Repository\/Faculties/Faculty of Sharia",
"Size":"3"
}
]

,"FileDetails":[
]

}


Then after that this is my script code, I want to know why this change happened cause it's ok with the rest of the code the problem happened only with company home path.

mycode.js

        $(function(){
            var $orders = $('#faulty-order');
        try {
            $.ajax({
                url:  "http://localhost:8089/alfresco/service/digirepo/content.json?guest=true",
                type: 'GET',
                contentType: 'application/json',
                dataType: 'json',
                async: false,
                success: function (orders) {
                    $.each(orders.FolderDetails, function(i,order){
                        $orders.append('<li><a href="'+ order.Path+'">' + order.Name + '</a></li>');
                    });
                }
            });
        }catch(e){
            alert("There's something wrong");
        }   
        });


when I click on the path in the url, it shows me error cause it should be /Company%20Home/ but what's happening is that /company_home/

Outcomes