Skip to content

Birmingham | 26-SDC-Mar | Chioma Okeke | Sprint 2 | jq#403

Open
JanefrancessC wants to merge 1 commit intoCodeYourFuture:mainfrom
JanefrancessC:jq
Open

Birmingham | 26-SDC-Mar | Chioma Okeke | Sprint 2 | jq#403
JanefrancessC wants to merge 1 commit intoCodeYourFuture:mainfrom
JanefrancessC:jq

Conversation

@JanefrancessC
Copy link
Copy Markdown

@JanefrancessC JanefrancessC commented Mar 20, 2026

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Completed exercises in /jq.

@JanefrancessC JanefrancessC added 🐂 Size Medium 1-4 hours 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Tools The name of the module. labels Mar 20, 2026
Copy link
Copy Markdown

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your solution works. I just have a few questions.

Comment thread jq/script-01.sh
# The input for this script is the person.json file.
# TODO: Write a command to output the name of the person.
# Your output should be exactly the string "Selma", but should not contain any quote characters.
jq -r '.name' < person.json No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not specify the file input directly as

jq -r '.name' person.json

That is, without using input redirection?

Copy link
Copy Markdown
Author

@JanefrancessC JanefrancessC May 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used redirection as a reminder of different approaches I can use to solve the problem.

Comment thread jq/script-02.sh
# The input for this script is the person.json file.
# TODO: Write a command to output the address of the person, all on one line, with a comma between each line.
# Your output should be exactly the string "35 Fashion Street, London, E1 6PX", but should not contain any quote characters.
jq -jr '.address | join(", "), "\n"' < ./person.json No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use -j option and then manually output the newline character? (Your commands in other script don't follow this approach)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read about the -j flag as well, just a reminder that it takes out `\n' characters.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Tools The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 🐂 Size Medium 1-4 hours 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants