Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork, Commit, Merge - Medium Issue (JSON) #1449

Open
nikohoffren opened this issue Nov 6, 2023 · 0 comments
Open

Fork, Commit, Merge - Medium Issue (JSON) #1449

nikohoffren opened this issue Nov 6, 2023 · 0 comments

Comments

@nikohoffren
Copy link
Member

Fork, Commit, Merge - Medium Issue (JSON)

JSON Parsing and Manipulation (In Your Preferred Language)

Note: You don't have ask permission to start solving the issue or get assigned, since these issues are supposed to be always open for new contributors. The actions-user bot will reset the file back to previous state for the next contributor after your commit is merged. So you can just simply start working with the issue right away!

Description

The task is to parse and manipulate a given JSON object in data.json. The goal is to filter out specific fields, manipulate other fields, and then generate a new JSON object.

json-medium

How to get started

Open the tasks/json/medium directory from the root of your project.
Then start working with your solution by creating a file (for example in JavaScript processJSON.js) in your preferred language.

Requirements

  • Read the provided JSON file data.json which contains an array of objects.
  • Filter out all objects where the status is inactive.
  • Update the price field by applying a 10% tax.
  • Write the resulting array of objects to a new JSON file called updated_data.json.

Expected output (updated_data.json)

[
    {
        "name": "Product 1",
        "price": 110,
        "status": "active"
    },
    {
        "name": "Product 3",
        "price": 330,
        "status": "active"
    }
]

If the script works correctly, you should see the product with status as inactive, filtered out from the result.

How to run

First, make sure you are in the correct directory:

cd tasks/json/medium

Running your script depends on the language you have chosen to work with:

Using JavaScript:

node processJSON.js

Using Python:

python processJSON.py

Using Ruby:

ruby processJSON.rb

After your script successfully creates new updated_data.json file, you are ready to make a pull request!


Check out README.md for more instructions and how to make a pull request.

Feel free to ask any questions here if you have some problems!

Also, kindly give this project a star to enhance its visibility for new developers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant