This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Hilfe bei Script
#1
Moin zusammen,

ich bin dabei etwas zu versuchen und bekomme es leider nicht so ganz hin. Ich will aus einem export von Personenbezogenen Daten die als Json geliefert wird folgendes machen:

Ausschnitt von Export:

"identificators": [

{
"name": "AAA"
"id": "AAA-11111"
},


{
"name": "BBB"
"id": "BBB-22222"
},

{
"name": "CCC"
"id": "CCC-33333"
},
]


Für meine Auswertung benötige ich nur einen Identificator bsp name "BBB" mit id "BBB-22222".


Kann mir hier jmd helfen ?
Zitieren
#2
Irgendwie kommt mir der Json Code komisch vor , da fehlen doch Kommers oder nicht ?
Wenn es so aussehen tut dann geht es aufjedenfall schon mal so


var json={"identificators": [{
"name": "AAA",
"id": "AAA-11111"
},{
"name": "BBB",
"id": "BBB-22222"
},{
"name": "CCC",
"id": "CCC-33333"
}]};

console.log(json.identificators[1].name)
console.log(json.identificators[1].id)


Hier sind alle meine Lösungen aus allen Foren. Ich helfe auch in Facebook-chat
Als Lösung markieren Zitieren
#3
hallo, vielleicht hilft dir das? bin halt noch anfänger!

 arrays sind der reihe nach durchnummeriert 0,1,2

<p id="demo"></p>

<script>
 const myJSON = '["Test1", "Test2", "Test3"]';
 const myArray = JSON.parse(myJSON);
 document.getElementById("demo").innerHTML = myArray[1];
</script>


 hier noch eine kleine hilfe:
 jsonlint ist ein validator und umformatierer für json

 https://jsonlint.com/
Als Lösung markieren Zitieren


Gehe zu:


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