Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
How to get a value from a specific JavaScript Object?
#2
Unfortunately, I don't know your attempts, and whether you still use Jsons.parse or strinfify.
With the code I see now, you could do it like this.

Code:
var array = {
  id: 9215,
  rev: 8,
  fields: {
    "System.Id": 9215,
    "System.AreaId": 277,
    "System.AreaPath": "GisAtWeb",
    "System.TeamProject": "GisAtWeb",
    "System.NodeName": "GisAtWeb",
    "System.AreaLevel1": "GisAtWeb",
    "System.Rev": 8,
    "System.AuthorizedDate": "2021-01-28T13:15:15.623Z",
    "System.RevisedDate": "9999-01-01T00:00:00Z",
    "System.IterationId": 269,
    "System.IterationPath": "GisAtWeb",
    "System.IterationLevel1": "GisAtWeb",
    "System.WorkItemType": "Task",
    "System.State": "Done",
    "System.Reason": "Work finished",
    "System.CreatedDate": "2021-01-27T16:20:49.98Z",
    "System.CreatedBy": {
      displayName: "Schulze, Markus",
      url: "****",
      _links: [Object],
      id: "b5d776ba-c31e-6957-8ec4-5623fe2b1118",
      uniqueName: "Markus.Schulze@vwfsdev.com",
      imageUrl: "****",
      descriptor: "aad.YjVkNzc2YmEtYzMxZS03OTU3LThlYzQtNTYyM2ZlMmIxMTE4"
    },
    "System.ChangedDate": "2021-01-28T13:15:15.623Z",
    "System.ChangedBy": {
      displayName: "Dominic Taubald",
      url: "****",
      _links: [Object],
      id: "8270861f-3fe2-6e7d-a347-ec9f1ecd20f2",
      uniqueName: "Dominic.Taubald@vwfsdev.com",
      imageUrl: "****",
      descriptor: "aad.ODI3MDg2MWYtM2ZlMi03ZTdkLWEzNDctZWM5ZjFlY2QyMGYy"
    },
    "System.AuthorizedAs": {
      displayName: "Dominic Taubald",
      url:
        "https://spsprodweu4.vssps.visualstudio.com/A511b7ce7-5e78-4cdc-b847-d020b420fde2/_apis/Identities/8270861f-3fe2-6e7d-a347-ec9f1ecd20f2",
      _links: [Object],
      id: "8270861f-3fe2-6e7d-a347-ec9f1ecd20f2",
      uniqueName: "Dominic.Taubald@vwfsdev.com",
      imageUrl: "****",
      descriptor: "aad.ODI3MDg2MWYtM2ZlMi03ZTdkLWEzNDctZWM5ZjFlY2QyMGYy"
    },
    "System.PersonId": 81022228,
    "System.Watermark": 78852,
    "System.CommentCount": 0,
    "System.Title":
      "[20210127] Deployment Task - Changelog aktualisieren / prüfen gegen Deployment-Script",
    "Microsoft.VSTS.Common.StateChangeDate": "2021-01-28T13:15:15.623Z",
    "Microsoft.VSTS.Common.ClosedDate": "2021-01-28T13:15:15.623Z",
    "Microsoft.VSTS.Common.ClosedBy": {
      displayName: "Dominic Taubald",
      url: "****",
      _links: [Object],
      id: "8270861f-3fe2-6e7d-a347-ec9f1ecd20f2",
      uniqueName: "Dominic.Taubald@vwfsdev.com",
      imageUrl: "****",
      descriptor: "aad.ODI3MDg2MWYtM2ZlMi03ZTdkLWEzNDctZWM5ZjFlY2QyMGYy"
    },
    "Microsoft.VSTS.Common.Priority": 2,
    "System.Description":
      '<div><b><u>Changelog:</u></b></div><div><br></div><div>Folgende Konfigurationen müssen im Deployment-Script berücksichtigt werden:</div><div><br></div><div><ul><li>Konfiguration der Route über IDP ohne BlueCoat Proxy (ICAP Virenscanner Komponente) ist im APIM Korrekt hinterlegt. (<span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;">Statt <i>fsb-gateway.vwfs.com</i>\n' +
      'wird <i>gateway-cert.vwfs.com </i>mit SSL verwendet) Siehe Screenshot</span></li><li><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;">Anpassung Deployment-Script, wenn das Zertifikat manuell im Portal geändert wurde: Anpassung Fingerprint (Zertifkats-Id) im Deployment-Script</span></li><li><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;"><br></span></li></ul></div><div><br><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;"></span></div><div><img src="https://dev.azure.com/vwfs/55bf3504-405f-46ad-a342-fb8edcf4913f/_apis/wit/attachments/21e69dea-3b77-4baa-bc80-e4f4b6bbd370?fileName=sc.jpg" alt=sc.jpg><br></div>'
  },
  _links: {
    self: {
      href: "****"
    },
    workItemUpdates: {
      href: "****"
    },
    workItemRevisions: {
      href: "****"
    },
    workItemComments: {
      href: "****"
    },
    html: {
      href: "****"
    },
    workItemType: {
      href: "****"
    },
    fields: {
      href: "****"
    }
  },
  url: "link"
};

console.log(array.id);


console.log(array.fields["System.Id"]);
console.log(array.fields["System.AreaId"]);
console.log(array.fields["System.AreaPath"]);
console.log(array.fields["System.TeamProject"]);
console.log(array.fields["System.NodeName"]);
console.log(array.fields["System.AreaLevel1"]);
console.log(array.fields["System.Rev"]);
console.log(array.fields["System.AuthorizedDate"]);
console.log(array.fields["System.RevisedDate"]);
console.log(array.fields["System.IterationId"]);
console.log(array.fields["System.IterationPath"]);
console.log(array.fields["System.IterationLevel1"]);
console.log(array.fields["System.WorkItemType"]);
console.log(array.fields["System.State"]);
console.log(array.fields["System.Reason"]);
console.log(array.fields["System.CreatedDate"]);


console.log(array.fields["System.CreatedBy"]["displayName"]);
console.log(array.fields["System.CreatedBy"]["url"]);
console.log(array.fields["System.CreatedBy"]["_links"]);
console.log(array.fields["System.CreatedBy"]["id"]);
console.log(array.fields["System.CreatedBy"]["uniqueName"]);
console.log(array.fields["System.CreatedBy"]["imageUrl"]);
console.log(array.fields["System.CreatedBy"]["descriptor"]);
Hier sind alle meine Lösungen aus allen Foren. Ich helfe auch in Facebook-chat
Zitieren


Nachrichten in diesem Thema
RE: How to get a value from a specific JavaScript Object? - von admin - 07.01.2023, 01:56

Gehe zu:


Benutzer, die gerade dieses Thema anschauen:
1 Gast/Gäste