Hi everyone,
a need parse son from alfresco API, but I have problem with two slashes in URL model address. How can I get value from "prejimka.stavHodnoceni"? Can anyone help me ?
My
var nazevSlozky = null;
var result = remote.call("/api/metadata?nodeRef=workspace://SpacesStore/7d2eab73-9500-406a-bdb0-40209924b2d2");
var json = JSON.parse(result);
var nazevSlozky = json.properties.{http://ourFirm.cz/model/someFirm/3.0.}prejimka.stavHodnoceni;
JSON:
{
"nodeRef": "workspace://SpacesStore/7d2eab73-9500-406a-bdb0-40209924b2d2",
"aspects": ["{http://ourFirm.cz/model/someFirm/3.0.}stavba", "{http://www.alfresco.org/model/application/1.0}defaultViewConfig", "{http://ourFirm.cz/model/someFirm/3.0.}prejimka", "{http://www.alfresco.org/model/system/1.0}referenceable", "{http://www.alfresco.org/model/system/1.0}localized", "{http://ourFirm.cz/model/someFirm/3.0.}casoveRazitko", "{http://www.alfresco.org/model/system/1.0}incomplete", "{http://www.alfresco.org/model/content/1.0}titled", "{http://www.alfresco.org/model/system/1.0}cascadeUpdate", "{http://ourFirm.cz/model/someFirm/3.0.}kontrolaKdir", "{http://www.alfresco.org/model/content/1.0}auditable", "{http://ourFirm.cz/model/someFirm/3.0.}kontrola", "{http://ourFirm.cz/model/someFirm/3.0.}zhotovitel", "{http://ourFirm.cz/model/someFirm/3.0.}lokace"],
"mimetype": "application/octet-stream",
"type": "{http://ourFirm.cz/model/someFirm/3.0.}prejimkaSl",
"properties": {
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.stavHodnoceni": "i42",
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.datumPredaniZhotovitelem": null,
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.typPrejimky": "gzDomereni",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.schvalujiciUserName": "admin",
"{http://www.alfresco.org/model/content/1.0}creator": "admin",
"{http://www.alfresco.org/model/system/1.0}store-identifier": "SpacesStore",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.prevzatoKeSchvaleni1": "2018-10-09T08:15:14.256Z",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.poslatNotifikaci": "schvaleno",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.schvaleno2": null,
"{http://ourFirm.cz/model/someFirm/3.0.}zhotovitel.primarniEmail": "",
"{http://ourFirm.cz/model/someFirm/3.0.}zhotovitel.kontaktniEmail1": "",
"{http://www.alfresco.org/model/system/1.0}cascadeTx": 4702,
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.schvaleno1": "2018-10-09T12:18:13.133Z",
"{http://ourFirm.cz/model/someFirm/3.0.}stavba.cisloStavby": "46",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.pocetSchvalovani": 2,
"{http://www.alfresco.org/model/application/1.0}defaultViewId": "someFirm:dokument_prejimky",
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.datumFormalnichKontrol": null,
"{http://ourFirm.cz/model/someFirm/3.0.}kontrolaKdir.poznamkaKdir": "",
"{http://www.alfresco.org/model/system/1.0}store-protocol": "workspace",
"{http://www.alfresco.org/model/system/1.0}node-dbid": 3089,
"{http://ourFirm.cz/model/someFirm/3.0.}stavba.cisloEtapy": "001",
"{http://ourFirm.cz/model/someFirm/3.0.}zhotovitel.userID": "",
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.prubehSchvalovani": "Převzato ke schválení v 1. kroku; 5.09.2018 11:06; Administrator",
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.technologie": "PK",
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.preferovanyHodnotitel": "sanda@ourFirm.cz",
"{http://ourFirm.cz/model/someFirm/3.0.}zhotovitel.kontaktniTelefon": "",
"{http://www.alfresco.org/model/content/1.0}created": "2018-08-27T07:21:46.989Z",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrolaKdir.stav": "i42",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.odmitl": null,
"{http://www.alfresco.org/model/content/1.0}description": "",
"{http://ourFirm.cz/model/someFirm/3.0.}zhotovitel.kontaktniEmail2": "",
"{http://www.alfresco.org/model/system/1.0}node-uuid": "7d2eab73-9500-406a-bdb0-40209924b2d2",
"{http://www.alfresco.org/model/content/1.0}name": "necoooo",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.Stav": "cekaNaSchvaleni2",
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.datumVpusteniPlynu": null,
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.duvodZamitnuti": "asdasasda",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.schvalujici": null,
"{http://www.alfresco.org/model/system/1.0}cascadeCRC": 238143219,
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.pocetOdmitnuti": 41,
"{http://ourFirm.cz/model/someFirm/3.0.}stavba.rozliseniStavby": "i42",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.schvalovatel1": "Administrator ",
"{http://ourFirm.cz/model/someFirm/3.0.}lokace.mistrovskyOkrsek": "42104",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.odmitnuto": null,
"{http://ourFirm.cz/model/someFirm/3.0.}zhotovitel.zhotovitelFirma": "",
"{http://www.alfresco.org/model/content/1.0}title": "",
"{http://ourFirm.cz/model/someFirm/3.0.}lokace.regionalniOblast": "423",
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.duvodNeschvaleni": null,
"{http://ourFirm.cz/model/someFirm/3.0.}kontrolaKdir.datumSpusteni": null,
"{http://ourFirm.cz/model/someFirm/3.0.}zhotovitel.kontaktniOsoba": "",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.schvalovatel2": null,
"{http://www.alfresco.org/model/system/1.0}locale": "cs_CZ",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrola.prevzatoKeSchvaleni2": null,
"{http://www.alfresco.org/model/content/1.0}modifier": "admin",
"{http://www.alfresco.org/model/content/1.0}modified": "2018-10-10T15:00:49.469Z",
"{http://ourFirm.cz/model/someFirm/3.0.}kontrolaKdir.datumUkonceni": null,
"{http://ourFirm.cz/model/someFirm/3.0.}prejimka.stavFormalnichKontrol": "probihaHodnoceni"
}
}
Solved! Go to Solution.
The jsonUtils object is total crap, has a lot of bugs (though mostly with converting objects to JSON) and the values it creates are not 100% native objects - I advise everyone to never use it. Using native JSON parsing is always preferable.
The problem in this case seems to be a lack of understanding of how properties in JavaScript objects can be accessed.
Instead of:
json.properties.{http://ourFirm.cz/model/someFirm/3.0.}prejimka.stavHodnoceni
the proper use would be
json.properties['{http://ourFirm.cz/model/someFirm/3.0.}prejimka.stavHodnoceni']
and et voila, no problems with the slashes or any other characters.
Are you in the right context to access the jsonUtils root object?
The jsonUtils object is total crap, has a lot of bugs (though mostly with converting objects to JSON) and the values it creates are not 100% native objects - I advise everyone to never use it. Using native JSON parsing is always preferable.
The problem in this case seems to be a lack of understanding of how properties in JavaScript objects can be accessed.
Instead of:
json.properties.{http://ourFirm.cz/model/someFirm/3.0.}prejimka.stavHodnoceni
the proper use would be
json.properties['{http://ourFirm.cz/model/someFirm/3.0.}prejimka.stavHodnoceni']
and et voila, no problems with the slashes or any other characters.
..gut hingeschaut - ich hatte den Codeteil auf dem iPad gar nicht richtig gesehen..
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.