0

I am reading a server status by calling a HTTP request from a Javascript in Node JS. The resulting data structure is as follows:

{ serverStats:
   { source:
      [ { '$': { mount: '/testServ.mp3' },
          Connected: [ '123' ],
          'content-type': [ 'audio/mpeg' ] }
      ] } }

I can extract "serverStats", and "source" objects by using for loop and Object.keys.

Problem: how do I access the "mount" field in source object? There's a "$" sign and I don't know what it means as I am new to NodeJS.

hhs_89
  • 9
  • 4
  • The `$` sign has no special meaning in JS/nodejs, it is an identifier like any other and can be used as a variable or property name. As to why it is found in your response, you'd have to ask the API provider. – Bergi Nov 03 '19 at 21:57

1 Answers1

0

Since source is an array : x.serverStats.source[0]["$"].mount

Quinox
  • 573
  • 3
  • 14