Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8984071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:59:58+00:00 2026-06-15T20:59:58+00:00

I got two functions that return a list of dictionary and i’m trying to

  • 0

I got two functions that return a list of dictionary and i’m trying to get json to encode it, it works when i try doing it with my first function, but now i’m appending second function with a syntax error of ": expected". I will eventually be appending total of 7 functions that each output a list of dict. Is there a better way of accomplishing this?

import dmidecode
import simplejson as json

def get_bios_specs():
    BIOSdict = {}
    BIOSlist = []
    for v in dmidecode.bios().values():
        if type(v) == dict and v['dmi_type'] == 0:
            BIOSdict["Name"] = str((v['data']['Vendor']))
            BIOSdict["Description"] = str((v['data']['Vendor']))
            BIOSdict["BuildNumber"] = str((v['data']['Version']))
            BIOSdict["SoftwareElementID"] = str((v['data']['BIOS Revision']))
            BIOSdict["primaryBIOS"] = "True"

            BIOSlist.append(BIOSdict)
    return BIOSlist

def get_board_specs():
    MOBOdict = {}
    MOBOlist = []
    for v in dmidecode.baseboard().values():
        if type(v) == dict and v['dmi_type'] == 2:
           MOBOdict["Manufacturer"] =  str(v['data']['Manufacturer'])
           MOBOdict["Model"] = str(v['data']['Product Name'])

           MOBOlist.append(MOBOdict)
    return MOBOlist


def get_json_dumps():
    jsonOBJ = json

    #Syntax error is here, i can't use comma to continue adding more, nor + to append.
    return  jsonOBJ.dumps({'HardwareSpec':{'BIOS': get_bios_specs()},{'Motherboard': get_board_specs()}})
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:00:00+00:00Added an answer on June 15, 2026 at 9:00 pm

    Use multiple items within your nested dictionary.

    jsonOBJ.dumps({
        'HardwareSpec': {
            'BIOS': get_bios_specs(),
            'Motherboard': get_board_specs()
         }
    })
    

    And if you want multiple BIOS items or Motherboard items, just use a list.

    ...
         'HardwareSpec': {
            'BIOS': [
                get_bios_specs(),
                get_uefi_specs()
            ]
            ...
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a controller, I got two functions that one is made to be private:
I've got a script that calls two functions, A and B, from the same
I got this two functions exports.list = function (req, res){ Material.find(function(err, materials) { res.render('materials/list',
I've got two functions that calculate the factorial of a number n. I can't
I've got a very simple VBA function that takes two range arguments and returns
I've got a function that takes two strings as arguments, and I want to
im trying to get multi texturing working and have so far got miltiple textures
I've got a list view in my MVC app that shows a check box
I've got two competing problems. Situation Got a Massive Listview 10k+ items that I'm
I've got a list of links on a main page that can be filtered

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.