Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

62
Views
object name with dot in it

I have some config file that I need to create, its a routers configuration file and I am trying to programmatically create the file. An excerpt of the file is like this.

link.b:{
  en:0x1f,
  an:0x1f,
  spdc:[0x0,0x00,0x00,0x00,0x00,0x00],
  dpxc:0x1f,
  fct:0x0,
  fp1:0x3e,
  fp2:0x3d,
  fp3:0x3b,
  fp4:0x37,
  fp5:0x2f,
  fp6:0x1f,
  lck:0x0,
  lckf:0x0,
  imr:0x0,
  omr:0x0,
  mrto:0x1,
  vlan:[0x1,0x01,0x01,0x01,0x01,0x01],
  vlnh:[0x0,0x00,0x00,0x00,0x00,0x00],
  vlni:[0x0,0x00,0x00,0x00,0x00,0x00],
  dvid:[0x1,0x000b,0x000b,0x000a,0x000b,0x0001],
  fvid:0x0,
  ir:[0x0,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000],
  or:[0x0,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000],
  srt:[0x0,0x00,0x00,0x00,0x00,0x00],
  suni:0x0,
  poe:[0x1,0x02,0x02,0x02,0x02,0x00],
  prio:[0xff,0x00,0x01,0x02,0x03,0x00],
  nm0:'506f727431',
  nm1:'506f727432',
  nm2:'506f727433',
  nm3:'343033',
  nm4:'343039'
},

So I need to somehow export link.b I can't create an object like that because I need to either nest b inside of link but then the output (expectedly) is

  link: {
    b: {
      en: 31,
      an: 63,
      spdc: [ 0, 0, 0, 0, 0, 0 ],
      dpxc: 63,
      fct: 63,
      fp1: 62,
      fp2: 61,
      fp3: 59,
      fp4: 55,
...

which is not valid for the router. and doing

'link.b' : {
      en: 31,
      an: 63,
      spdc: [ 0, 0, 0, 0, 0, 0 ],
      dpxc: 63,
      fct: 63,
      fp1: 62,
      fp2: 61,
      fp3: 59,
      fp4: 55,
....

Is equally invalid for the router. So is there anyway I can output link.b : { not 'link.b' : { and not link : { b: {

7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs