从 JSON 输出中获取字符串
Get String from JSON output
如何从
获取.largeImage
Game {
name: 'Spotify',
type: 2,
url: null,
details: 'Promises (with Sam Smith)',
state: 'Calvin Harris; Sam Smith; Jessie Reyez',
applicationID: null,
timestamps:
{ start: 2019-01-25T19:58:17.089Z,
end: 2019-01-25T20:01:50.398Z },
party: { id: 'spotify:365162284655443978' },
assets:
RichPresenceAssets {
largeText: 'Promises (with Sam Smith)',
smallText: null,
largeImage: 'spotify:b0875765de11e1b6bdfbdd07c2de72e65c02f524',
smallImage: null },
syncID: '5N5k9nd479b1xpDZ4usjrg',
_flags: 48 }
RichPresenceAssets {
largeText: 'Promises (with Sam Smith)',
smallText: null,
largeImage: 'spotify:b0875765de11e1b6bdfbdd07c2de72e65c02f524',
smallImage: null }
我试过了
Game.assets.RichPresenceAssets.largeImage
但那是 undefined
所以现在该怎么办,我找不到要使用的东西,也找不到要使它正常工作的方法。
提前致谢!
我认为这应该可行:
assets.largeImage
或
yourGameVariable.assets.largeImage
您应该将 yourGameVariable
替换为包含给定转储的变量。
您似乎从开发工具控制台粘贴了转储。您可以使用 JSON.stringify 来获得有效的 JSON.
我想 Game
和 RichPresenceAssets
只是 class 个名字。
如何从
获取.largeImageGame {
name: 'Spotify',
type: 2,
url: null,
details: 'Promises (with Sam Smith)',
state: 'Calvin Harris; Sam Smith; Jessie Reyez',
applicationID: null,
timestamps:
{ start: 2019-01-25T19:58:17.089Z,
end: 2019-01-25T20:01:50.398Z },
party: { id: 'spotify:365162284655443978' },
assets:
RichPresenceAssets {
largeText: 'Promises (with Sam Smith)',
smallText: null,
largeImage: 'spotify:b0875765de11e1b6bdfbdd07c2de72e65c02f524',
smallImage: null },
syncID: '5N5k9nd479b1xpDZ4usjrg',
_flags: 48 }
RichPresenceAssets {
largeText: 'Promises (with Sam Smith)',
smallText: null,
largeImage: 'spotify:b0875765de11e1b6bdfbdd07c2de72e65c02f524',
smallImage: null }
我试过了
Game.assets.RichPresenceAssets.largeImage
但那是 undefined
所以现在该怎么办,我找不到要使用的东西,也找不到要使它正常工作的方法。
提前致谢!
我认为这应该可行:
assets.largeImage
或
yourGameVariable.assets.largeImage
您应该将 yourGameVariable
替换为包含给定转储的变量。
您似乎从开发工具控制台粘贴了转储。您可以使用 JSON.stringify 来获得有效的 JSON.
我想 Game
和 RichPresenceAssets
只是 class 个名字。