A
A
Arseniy Sokolovsky2020-10-18 16:24:02
JavaScript
Arseniy Sokolovsky, 2020-10-18 16:24:02

How to get time from JSON?

I have JSON:

{
  "MapName": "Adeyyo",
  "JDVersion": 2019,
  "OriginalJDVersion": 2019,
  "Artist": "Ece Seçkin",
  "Title": "Adeyyo",
  "Credits": "Written by Aysen Şimşekyay, Kemal Şimşekyay and arranged by Ozan Doğulu. Published by DMC & PRM. Courtesy of DGL. All rights of the producer and other rightholders to the recorded work reserved. Unless otherwise authorized, the duplication, rental, loan, exchange or use of this video game for public performance, broadcasting and online distribution to the public are prohibited.",
  "NumCoach": 1,
  "BannerVideo": 0,
  "CoachBeat": 1210,
  "OnlineMap": 0,
  "Tags": [
  "main"
  ],
  "PictogramBar": 1,
  "PictoDuration": 3000,
  "BeatDuration": 3000,
  "LyricDuration": 1750,
  "PictoResolutionX": 256,
  "PictoResolutionY": 256,
  "PictoResolutionUHD": 0,
  "VideoType": "mp4",
  "AudioType": "ogg",
  "LyricColors": [111, 255, 182],
  "LyricSpeed": 100,
  "goldmoves": [166105,  226105],
  "Difficulty": 1,
  "DefaultColors": {
    "lyrics": "0xFF6FFFB6",
    "theme": "0xFFFFFFFF",
    "songColor_1A": "0xFF010342",
    "songColor_1B": "0xFF411554",
    "songColor_2A": "0xFF97FAFC",
    "songColor_2B": "0xFF11B7C6"
  }


How can I take "LyricDuration" from it and use it in setTimeout()?

Like something like this:
setTimeout(function, LyricDuration) To take the value from LyricDuration and insert it into setTimout() ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-10-18
@SokolarGm

var obj = {
  "MapName": "Adeyyo",
  "JDVersion": 2019,
  "OriginalJDVersion": 2019,
  "Artist": "Ece Seçkin",
  "Title": "Adeyyo",
  "Credits": "Written by Aysen Şimşekyay, Kemal Şimşekyay and arranged by Ozan Doğulu. Published by DMC & PRM. Courtesy of DGL. All rights of the producer and other rightholders to the recorded work reserved. Unless otherwise authorized, the duplication, rental, loan, exchange or use of this video game for public performance, broadcasting and online distribution to the public are prohibited.",
  "NumCoach": 1,
  "BannerVideo": 0,
  "CoachBeat": 1210,
  "OnlineMap": 0,
  "Tags": [
    "main"
  ],
  "PictogramBar": 1,
  "PictoDuration": 3000,
  "BeatDuration": 3000,
  "LyricDuration": 1750,
  "PictoResolutionX": 256,
  "PictoResolutionY": 256,
  "PictoResolutionUHD": 0,
  "VideoType": "mp4",
  "AudioType": "ogg",
  "LyricColors": [111, 255, 182],
  "LyricSpeed": 100,
  "goldmoves": [166105, 226105],
  "Difficulty": 1,
  "DefaultColors": {
    "lyrics": "0xFF6FFFB6",
    "theme": "0xFFFFFFFF",
    "songColor_1A": "0xFF010342",
    "songColor_1B": "0xFF411554",
    "songColor_2A": "0xFF97FAFC",
    "songColor_2B": "0xFF11B7C6"
  }
}

var value = 0;

for (let key in obj) {
  if (key === "LyricDuration") value += obj[key]
}

// value === 1750

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question