Trending December 2023 # How To Format Write Protected Usb Pendrive # Suggested January 2024 # Top 14 Popular

You are reading the article How To Format Write Protected Usb Pendrive updated in December 2023 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 How To Format Write Protected Usb Pendrive

How To Format Write Protected USB Pendrive How To Check If The Disk Is Write-Protected Or Corrupted?

Before we go ahead, make sure that your USB pen drive is not corrupted and should be genuinely write-protected. Below are some points to check your USB pen drive is corrupted:

If your pen drive is not detected in your PC or laptop, it might be defective and can’t be fixed.

If you are using a USB drive or SD card in your PC or laptop and a message pops up “Drive is Corrupted”.

Also Read: Best USB Port Blocker Software For Windows

Remove Write-Protected On Pen Drive Using Regedit.exe

Enter the value data as “0” and select OK.

Close the Registry Editor and restart your PC or laptop.

Also Read: How to Fix USB Not Working in Windows 10

Diskpart command prompt windows will open and type list disk and press enter. All the drives including your pen drive will appear in the window.

Now, every drive is labelled with a disk number, identify your USB drive and type select disk #, press enter. Replace # with your pen drive number.

Now, type attributes disk clear read only and press enter. From this method, it will remove write-protected status from your pen drive.

To format USB stick, type clean and press enter, and it will remove all the data from your pen drive.

Now, type create partition primary and press enter. To create a partition on your USB drive.

And then, type format fs=fat32 or format fs=ntfs and press enter. That command will remove everything and make it read-only for your PC or laptop.

At last, type exit and press enter to return in standard command prompt. And you will be able to use your pen drive normally.

Remove Write-Protected On Pen Drive Using Disk Utility(Mac Only)

Insert your pen drive in your Mac and open Finder.

Now, select your pen drive from the left panel of Disk Utility and select Erase (on the top of Disk Utility window).

You can enter the drive name (optional) and select the file system type from the “Format”

We have mentioned above all the steps to format flash drive (write-protected) and if any of the steps are not working, we suggest you contact your pen drive manufacturer websites or support pages and forums to find the links of that tools that have confirmed to work with the USB device.

Quick Reaction:

About the author

Pranay Mathur

You're reading How To Format Write Protected Usb Pendrive

How To Add Or Remove Write Protection From A Usb Flash Drive.

If you have plugged in a USB flash drive and can’t seem to format it because of write protection, this guide will show you how to remove the write protection. You will also find out how to add write protection to prevent USB Flash drives being formatted easily.

How to Create, Merge, Shrink or Extend Partitions on Windows 10.

Sometimes when you connect a USB drive to your computer and start copying, moving, or deleting files you may receive an unusual The disk is write protected error. If you see this error it means that the drive has write protection and cannot be formatted using the standard procedure. Instead, you will need to manually remove the write protection in order to continue.


How Do You Find Out if a USB Drive Has Write Protection? Diskpart List Disk Select Disk


Attributes Disk

Once the commands finish, you will need to check the value next to Current Read-only State and Read-only If the value is Yes, it means write protection is enabled, if the value is No, write protection is disabled for the drive. Check the screenshot above for a better understanding. If you would like to change the write status of the USB drive, follow the steps in the below section.

How to Enable / Disable USB Write Protection on Windows.

Now that you know how to check if your drive does or doesn’t have write protection, we can begin the steps showing you how to change the write protection settings. The first thing you obviously need to do is connect the USB drive you want to change the write protection settings for to your computer. Once the drive is connected, open the Command Prompt tool once again in administrator mode. This time in the CMD window type the following commands, pressing Enter after each:

Diskpart List Disk Select Disk


To Disable write, delete, and format protection for the USB drive, type the following command and press Enter.

Attributes Disk Clear Readonly

To Enable write, delete, and format protection for the USB drive, type the following command and press Enter.

Attributes Disk Set Readonly

It’s important to remember that if you are wanting to enable write protection to prevent files from being deleted on your USB drive. It only works for the computer you enabled write protection on. Meaning if you connect the USB to another computer, write protection will be disabled.

Note: There are a few USB manufacturers that have hardware write protection, which will enable write protection for the drive no matter what computer you connect it to. You will need to check the specs for your USB drive on the manufacturer’s page to find out if you aren’t sure.

How To Write More Concisely

Concise writing presents ideas clearly and does not use more words than are truly necessary. Conciseness is an important characteristic of academic writing, especially given how complex the subject matter frequently is.

Two of the biggest enemies of concise writing are inflated phrases and redundancies. It’s easy to think that using more complicated-sounding phrases will give your text a more academic feel, but mostly it just makes it harder to follow.

Using the below strategies will make your writing not only tighter, but also more effective.

Avoid inflated phrases

One of the simplest ways to make your writing more concise is to avoid “inflated” phrases that use several words where just one or two would be sufficient.

Examples of inflated sentences in theses that you can write more concise

Inflated phrase Example More concise alternative Example

A majority of A majority of respondents were single parents. Most Most respondents were single parents.

A sufficient amount/number of A sufficient number of cases were selected.  Enough  Enough cases were selected

As a result of The interview was cancelled as a result of illness.  Because of, due to  The interview was cancelled due to illness.

At all times The laptop was kept in a locked office at all times.  Always  The laptop was always kept in a locked office.*

At the present time, at this point in time The IT sector is expanding at the present time.  Now, currently  The IT sector is currently expanding.*

By means of The surveys were distributed by means of email.  By  The surveys were distributed by email.

Draw attention to Articles often draw attention to the most problematic cases.  Point out, point to  Articles often point to the most problematic cases.

Due to the fact that, in light of the fact that This definition cannot be used due to the fact that it is too limiting.  Because  This definition cannot be used because it is too limiting.

For the purpose of  For

For the reason that Consultants were excluded for the reason that they are not regular staff.  Because  Consultants were excluded because they are not regular staff.

Have a tendency to Economists have a tendency to favor policy reform.  Tend to  Economists tend to favor policy reform.

Have an impact on Age appears to have an impact on confidence.  Affect  Age appears to affect confidence.

Have the ability to The scale has the ability to measure to the microgram.  Be able to, can  The scale can measure to the microgram.

In comparison to The data showed that CEOs earn more in comparison to CFOs.  Than  The results showed that CEOs earn more than CFOs.

In light of the fact that Saad’s theory is chosen in light of the fact that it is most relevant.  Because  Saad’s theory is chosen because it is most relevant.

In order to More research is needed in order to fill this gap.  To  More research is needed to fill this gap.

In spite of the fact that, despite the fact that In spite of the fact that the sample size was limited, …  Although  Although the sample size was limited, …

In the event that In the event that a question was left blank, …  If  If a question was left blank, …

In the neighborhood of The factory produces in the neighborhood of 5,000 cars a week.  About  The factory produces about 5,000 cars a week.

In the year YYYY Sales peaked in the year 2001.  YYYY  Sales peaked in 2001.

Is of the opinion Wang (2009) is of the opinion that the model must be expanded.  Thinks, believes  Wang (2009) believes that the model must be expanded.

Make a calculation of We made a calculation of the average IQ.  Calculate  We calculated the average IQ.

Make decisions about Marketers must make decisions about their target audience.  Decide on  Marketers must decide on their target audience.

On two occasions The patients were tested on two occasions.  Twice  The patients were tested twice.

Small in size The control group is relatively small in size.  Small  The control group is relatively small.

The people who are located in The people who are located in rural areas had fewer symptoms.  The people in  The people in rural areas had fewer symptoms.

The reason why The reason why the population decreased is unknown.  The reason  The reason the population decreased is unknown.

Until such time as Smartphones will be used until such time as a new technology is developed.  Until  Smartphones will be used until a new technology is developed.

Whether or not The goal was to identify whether or not gender made a difference.  Whether  The goal was to identify whether gender made a difference.

Avoid redundancies

Another easy way to make your writing more concise is to avoid redundancies, which occur when the same idea is being expressed twice. In most cases, the meaning of one word is clearly implied in another (for example, isn’t a summary by nature brief? Could collaboration be done in any other way but together? Isn’t an import by definition foreign?).

Examples of avoiding redundancies in theses

Redundant phrase Improvement

 Advance planning  Planning

 Alternative choice  Alternative

 And etcetera  Etcetera

 Ask the question  Ask

 Assemble together  Assemble

 Basic fundamentals  Fundamentals

 Biography/autobiography of her life  Biography/autobiography

 Brief moment  Moment

 Brief summary  Summary

 Careful scrutiny  Scrutiny

 Cash money  Cash

 Classify into groups  Classify

 Collaborate together  Collaborate

 Combine together  Combine

 Compete with each other  Compete

 Completely filled  Filled

 Cooperate together  Cooperate

 Could possibly  Could

 Crisis situation  Crisis

 Current incumbent  Incumbent

 Current trend  Trend

 Depreciate in value  Depreciate

 Different kinds  Kinds

 Disappear from sight  Disappear

 During the course of  During

 Each and every  Each

 Earlier in time  Earlier

 Empty space  Space

 Equal to each other  Equal

 Estimated at about  Estimate at

 Favorable approval  Approval

 Fellow colleague  Colleague

 Few in number  Few

 Final conclusion  Conclusion

 Final end  End

 First and foremost  Foremost

 First of all  First

 Follow after  Follow

 Foreign imports  Imports

 Former graduate  Graduate

 Free gift  Gift

 Future plans  Plans

 General public  Public

 Grow in size  Grow

 Had done previously  Had done

 HIV virus  HIV

 Input into  Input

 Interdependent on each other  Interdependent

 Introduced for the first time  Introduced

 Joint collaboration  Collaboration

 Knowledgeable experts  Experts

 Later time  Later

 Little baby  Baby

 Live audience  Audience

 May possibly  May

 Meet together  Meet

 Might possibly  Might

 Mix together  Mix

 Mutually interdependent  Interdependent

 Mutual respect for each other  Mutual respect

 New innovation  Innovation

 New invention  Invention

 None at all  None

 Oral conversation  Conversation

 Over exaggerate  Exaggerate

 Passing fad  Fad

 Past history  History

 Past memories  Memories

 Present time  Present

 Previously listed above  Previously listed

 Protest against  Protest

 Recur again  Recur

 Re-elect for another term  Re-elect

 Regular routine  Routine

 Reply back  Reply

 Safe haven  Haven

 Spell out in detail  Spell out

 Splice together  Splice

 Still persists  Persists

 Sum total  Total

 Surrounded on all sides  Surrounded

 Tall in height  Tall

 Two/2:00 pm in the afternoon  Two/2:00 pm

 Two equal halves  Halves

 True facts  Facts

 Unexpected surprise  Surprise

 Unintentional mistake  Mistake

 Very unique  Unique

 Visible to the eye  Visible


More about repetition and redundancy

Cite this Scribbr article

Vinz, S. Retrieved July 10, 2023,

Cite this article

How To Write An Awesome Case Study That Converts

Anyone can write nice things about their own brand.

But backing them up with real-life examples?

That’s another thing altogether.

Glowing promises and ambitious slogans aren’t always enough to convince consumers to try your brand.

A well-constructed case study provides can be the ideal format to showcase the benefits of your product or service – and persuade visitors to become buyers, clients, or loyal customers.

However, writing a compelling case study is no easy task.

Some things you will need to do:

Thoroughly analyze your actions when working on a certain project.

Gather customer feedback.

Summarize all your mistakes and victories.

Draw conclusions that convince readers of your professionalism and ability to help them achieve their goals.

But it will take some hard work and creative inspiration to get those increased conversions and larger sales you’re looking for.

This detailed guide will help you navigate the thorny path to writing a brilliant case study.

1. Choose Your Topic

Look for the most relevant examples that will appeal to your target market.

Irrelevant niche cases are unlikely to attract the audience you want.

If the majority of your clients are healthcare centers, for example, there is no point in writing a case study about a client from the retail industry.

Gear your content to your readers. Write about issues that will resonate with them.

2. Select a Suitable Client

Companies with hundreds or even thousands of clients may find it challenging to choose a sufficiently notable case for consideration.

Whether you choose a loyal long-time customer or a relatively new client, the main thing is to demonstrate how you faced an exceptional challenge and overcame it.

A big name client alone doesn’t make for an awesome case study.

Serving a market giant may add stars to your reputation, but it won’t be worth much in terms of converting customers if your analysis is superficial and meaningless.

It is important to highlight measurable results.

Your case study should demonstrate to readers how your company handles challenges in a professional way, with satisfactory results for all involved parties.

3. Hold an Interview & Collect Data

Accurate and detailed data is important when writing a convincing case study.

You can collect your data by conducting an interview with your chosen customer.

Start your conversation with a few ice-breaking questions to create a light and relaxing mood. Then gradually dig deeper to discover their opinions on the outcome of your joint project.

Important: Be sure to record your interview or take notes!

To get more detailed answers, you should ask open-ended questions. Dig into the “why” and “how” elements.

For example, if your client says, “Your solution is great. It simplified the lives of my employees,” ask for specific examples of how lives were simplified.

If at all possible, prompt your client for quantitative details.

An ideal answer would be something like, “Thanks to your solution, our company achieved a 20% revenue increase in three months. The number of clients grew by 634, and time spent decreased by 34%.”

Now you have measurable metrics that can be used to verify your product’s impact.

Here are some sample questions that will elicit detailed answers:

Did our solution pay off? What is the ratio between expenses and revenues as a result of this project?

Did new opportunities open up for your brand that were unattainable before?

How did you measure the success of this solution? What metrics did you use?

Even if the customer asks to remain anonymous, an abundance of specific data will increase the credibility of your case study.

4. Structure Your Case Study

With your client’s testimonial and accurate data at hand, you can proceed to outline your case study.

Use your outline to plan the writing of your case study in a way that will be engaging and reader-friendly.

Break your story down into steps that highlight how you resolved the issue.

Do more than merely state a problem and mentioning that you solved it.

Describe the intermediate stages to your readers in a step-by-step format.

Imagine reading a book without chapters, with only a prologue and epilogue. You would be left wondering what happened in between.

Your case study should answer the questions: who, what, where, when, and why, and conclude with a resounding how.


A title is the first element your potential clients will come across, so make it attention-grabbing and informative.

Your title should answer the following questions:

Who is this case study about?

What challenges did they face?

How was the problem addressed?

For example: “Online Retailer Sees Sales Double with PPC”.

Executive Summary

Start your case study by providing a short (1-2 small paragraph) profile of your client.

Smoothly transition to the reason you became involved.

What circumstances prompted the client to contact you?

The Challenge

Detail what obstacles your client faced, and describe their background prior to your intervention, to draw readers closer to the problem and demonstrate why your services are in demand.

The Challenge section should answer the following questions:

How did your client handle their daily processes prior to contacting you?

What obstacles did they face?

Did they try to solve the problem on their own? How exactly?

What results did they hope to get?

What state was the project in when it was assigned to you?

The Solution

The Challenge and Solution sections are essentially a question and an answer.

You have defined a certain problem, and now you will explain how it was solved.

Start by describing the research process, in particular:

Metrics collected during the initial analysis of the project.

Initially available tools, technologies, and resources.

Weak and strong aspects of the company.

Your client’s mission and corporate values.

Advantages of competitors that the client hoped to outrun.

Differences between the client’s strategy and those of market leaders. Gaps to be filled.

Manual processes to be automated and excessive costs to be cut.

The client’s ultimate goal for the project.

Several budget-friendly solutions, and what criteria informed your selection.

Provide detailed information on the chosen solution:

What tasks would it accomplish?

What benefits were expected?

How much time was needed to get the desired results?

What resources were needed?

Once you describe your research process, provide a step-by-step strategy showing how your solution was implemented.

Conduct a retrospective analysis and recall all your project-related moves.

Compile an outline, placing events in chronological sequence.

Then detail each step and substantiate the feasibility of decisions made.

Show that every minute of the customer’s time and every dollar from the project budget were well-spent.

After reading your case study, prospective clients should come away with an idea of exactly what you would do to realize their goals.

Do not simply write “we chose cutting edge technologies” or “we used the best practices.” These are vague and abstract statements.

Clearly state exactly what was done to arrive at a satisfactory solution.

Results / Achievements

Showcase the contrast between the project’s initial state and its success resulting from your efforts.

Emphasize the fact that you helped your client accomplish their goals.

Summarize positive changes in a concise bulleted list.

Provide measurable metrics.

If you continue working with the client after the project’s completion, list the metrics you plan to use for ongoing analysis, maintenance, and planning.

5. Pay Attention to Your Writing Style

In the first case, the study comes off as a dry, boring, and lifeless report written in niche lingo. Avoid complex professional terms, or at least provide comprehensive definitions.

Hopefully, the majority of your readers will be prospective clients, not colleagues.

Readers may not know about specific tools, terminology, and metrics, so present data in an easy-to-read and digestible form. Consider “callout” boxes for any obscure terms.

You want to emphasize the fact that your staff is capable of managing complex problems, but don’t overdo it.

Speak with expert authority, and back up all your recommendations with facts. Otherwise, your story won’t seem credible.

Try to find a happy medium between these two extremes.

Here are some tips that will help you develop a persuasive writing style:

Tell a story, don’t just list facts: The structure of a case study can be compared to the structure of a novel. Both have an introduction, a conflict, a climax, and a resolution. Describe your work on the project like a seamless plot, allowing readers to immerse themselves in your story. Infuse tension, suspense, and progress to make your case study truly exciting.

Present the issue you addressed as the antagonist, and your client as the protagonist: You play the role of a supporting character who helps the protagonist overcome challenges and arrive at a happy ending.

Show the situation from your client’s point of view: Don’t get so caught up in storytelling that you forget to showcase your client’s opinions. Remember, your client is the key figure in your story, and their point of view matters. Provide direct quotes to add credibility to your case study, but make sure the facts listed in your client’s quotes are not repeated in your own copy.

Quotes from your team members may also be useful: This will help visitors to your site get to know who will work on their projects.

Your main task is to satisfy the interest of potential clients: Do not use complex terms or describe technical nuances. A case study is a story about a real-life event, not a presentation for a professional conference.

Remember your formatting: It can be tedious to read lengthy pieces of text, so split them into paragraphs, and use numbered and bulleted lists, headers, subheaders, and other formatting tools. Sentences should be concise and deliver a single key thought.

6. Use Visuals

Use visuals to break up blocks of text and deliver important information in a bright and engaging way.

Embed key data in charts and tables. Take screenshots, or use images with your client’s products and logo.

7. Double-Check

Be sure to proofread and edit your case study.

Once the last line is written, take a break and look at it with fresh eyes after a day or two.

You will be better able to find minor mistakes and add new details.

8. Promote Your Case Study

When the final version of your study is polished and readable, publish it in a special section for case studies on your website, make announcements on social media, and include it in your email marketing campaign to attract more readers.

Consider filming a video version of your case study for release on YouTube.

Send tweets, using quotes from your client and team members.

Doing so will tell you whether you have chosen the right presentation style and promotion channels.

Common Mistakes

Even if you follow all the above tips, beware of common mistakes that can undermine the goals of your case study.

Avoid these detrimental tactics if you want to write a top-notch success story:

Too many writers: Involving a large number of colleagues or client representatives in writing your case study can become messy. Divergent viewpoints and bruised egos can quickly undermine your objectives and sabotage your efforts.

Forgetting about your target audience: Many specialists write about the things they know, using language that is common to them, without thinking about the potential reader. The success story of your project is not a personal diary. Draw a profile of the average visitor to your site and focus on their needs and interests.

Too lengthy case studies: Provide only the most valuable details, data, and conclusions. It is hard enough to keep readers focused on your content in the age of information. If your success story is filled with fluff, potential clients may quickly drop it and go elsewhere for more useful data.

Expecting huge victories and overlooking small achievements: Some companies believe that only large projects deserve to be featured in case studies, and published twice a year. However, visitors to your site may think you only had only two successful projects, and the rest, if any, were failures. Small achievements also matter, helping to build your good name brick by brick.


Keep your case study concise and to the point, and incorporate some of the above tips to improve your writing skills and boost conversions.

More Resources:

New #Marketingnerds Podcast: How To Write And Stay Up

Your browser does not support the audio element.

Visit our Marketing Nerds archive to listen to other Marketing Nerds podcasts!

In this week’s episode of the Marketing Nerds podcast, Executive Editor Kelsey Jones had a chance to sit down with Matt Southern, SEJ’s lead news writer, to talk about how he stays up-to-date with what’s happening in the industry.

Matt shares the tools he’s using and the sites he’d visit to get the breaking news. He also shared what makes good news and, if you’re a writer, how networking can help you write a better story.

Here are a few of transcribed excerpts from our discussion, but make sure to listen to the podcast to hear everything:

The Process of Finding and Writing Breaking News

I still swear by RSS. I’m still mourning the loss of Google Reader which was a free RSS reader that Google used to offer. They shuttered the service because they decided people weren’t using it enough or didn’t have daily active views users. I signed up to a paid RSS reader and I’ve been using that ever since. I love it because you get instant updates, as soon as the publication updates their website with a new article that’s right there in your reader. I couldn’t do my job without it quite frankly.

I love Feedbin which is $3 a month. It’s great because it’s simple like Google Reader was. It’s just a plain cut and dry list of news articles from publications. It does exactly what I want it to do and it’s an efficient way to consume news I find. Some other RSS readers out there that are free but are a bit different are apps like Feedly that you can get on your mobile device or use it on desktop, which is a bit more visual RSS reader.

There are so many out there. It’s all about finding what works best for you.

Places to Go for News How to Figure Out the Angle Useful to the Readers

You can get the news anywhere. Anybody has the facts about the news story itself, it’s being able to add that little something extra that your readers wants. Whatever that may be. For Search Engine I found that readers like to know the practical implications of a news story.

For example, if Google changes their algorithm the readers want to know what they have to do differently or how it might impact the content they have on their site now. Just reporting that there is an algorithm change is only useful to a certain extent, the next step would be to explain why and how that matters to the person reading it.

What it Takes to be a Good News Writer

Being immersed in the industry that you’re writing for is very important. For example, I’m immersed in SEO and marketing, I work with it everyday so I can write about it pretty competently. Could I write for a women’s fashion blog? Sure.  Would it be any good? Probably not as somebody who works in women’s fashion all day long. That’s one thing to consider.

Another thing is knowing what makes a good news story. Just because a company sends you a press release, it doesn’t mean that it’s interesting news. It’s just their latest update that they want to get out. It’s up to you to decide whether or not what they send to you is worth covering. That’s some kind of instinct that you have to learn naturally as you go and learn what your readers want to read about.

Being able to do your job fast and efficiently is a great skill to have but it’s also important to keep in mind that you don’t want to rush that news story out just for the sake hitting the publish button before anybody else because that can lead to lesser quality stories, it can lead to stories with half information or just wrong information.

How to Write a Good Event Recap

I approach recaps a similar way to how I approach news. I don’t like to just get the story out because you can get that at anywhere. For example with the US Search Awards I can write about the list of winners and sponsors and runners up and that sort of thing, but you can get that information from the official website or from just about anywhere else.

I like to paint a picture for the reader about how the event was and what they missed from not being there. I like to write about the ambiance, the setting, the crowd, how was the energy, was it a full attendance, any kind of interesting quotes that I got from attendees while I was there, what they thought about the event, are they going to go next year. That sort of thing that all adds more to the story.

Networking at events is very important because you can only gather so much from observing it on your own, mingling, getting out there and listening to what other people have to say about it is tremendously important.

The Importance of Networking for Breaking News Stories

That’s led to some of our best stories on Search Engine Journal to tell you truth because it’s exclusive information that I got first before someone else because I made that connection with that individual and we had a good rapport with each other and they decided they wanted to send me that news story to get out, have an exclusive on.

If a news story breaks and you want to know what someone thinks about it or if they work for a company they can provide some additional insight. Being able to know that person and having them recognize your name and your face when you reach out to them is extremely important.

You have to look at it in real life, because other people separate the digital world from the real world, but if you look at it like if you approach a company that you didn’t or someone in the company you didn’t know and asked them for a quote and they didn’t know who you were in real life, that would be awkward and unusual.

The same thing applies online, you have to think about it the same. If you’re just emailing someone out of the blue and they don’t know you and you’re asking them for help with something, it comes across as a little bit unnatural.

To listen to this Marketing Nerds podcast with Matt Southern and Kelsey Jones:

Download and listen to the full episode at the bottom of this post

Subscribe via iTunes

Sign up on IFTTT to receive an email whenever the Marketing Nerds podcast RSS feed has a new episode

Listen on Stitcher

Visit our Marketing Nerds archive to listen to other Marketing Nerds podcasts!

Image Credits

How Do I Write Json In Python?

In this article, we will learn different types of methods to write JSON in python.

Conversion Rules

When converting a Python object to JSON data, the dump() method follows the conversion rules listed below −

Writing Dictionary into a JSON File

The function of json.dump() is to arrange a Python object into a JSON formatted stream into the specified file.

Syntax dump(obj, fp, *, skipkeys=False, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw) Parameters

obj − obj is known as object that arranges as a JSON formatted stream.

fp −the fp also know as file object will store JSON data.

skipkeys − The default value is False. It ignores the Keys of dict that are not of a basic type. Orelse, it will throw a TypeError.

check_circular − It’s default value is True. It’s main task is to perform circular reference check for container types. This sometimes get the output result in an OverflowError.

allow_nan − It’s e default value is True. If false, serializing out-of-range float values will result in a chúng tôi uses JavaScript equivalents like -NaN, Infinity, -Infinity by default.

indent − It is used for good printing with a specified order.

separators − These are the ones used in the JSON.

default − this function is called when an object fails to serialized. It either returns object’s JSON-encoded version or throw a TypeError. If no type is given, a TypeError is defaulty thrown.

sort_keys − It’s default value is False. If true, the dictionaries’ output will be ordered/sorted by key.


The following program converts the given dictionary to a JSON file using the json.dump() function −

# importing json module import json # creating a dictionary inputDict = { "website": "Tutorialspoint", "authorName": "xyz", "Age": 25, "Address": "hyderabad", "pincode":"503004" } # opening a JSON file in write mode with open('outputfile.json', 'w') as json_file: # writing the dictionary data into the corresponding JSON file json.dump(inputDict, json_file) Output

On executing, the above program will generate the following output −

{"website": "Tutorialspoint", "authorName": "xyz", "Age": 25, "Address": "hyderabad", "pincode": "503004"}

A file named outputfile.json is created containing the above dictionary data.

Using the Indent Parameter

Use the indent parameter of the method dump() for attractive printing.


The following program converts the given dictionary to a pretty JSON file with indentation using the json.dump() function and indent argument −

# importing JSON module import json # creating a dictionary inputDict = { "website": "Tutorialspoint", "authorName": "xyz", "Age": 25, "Address": "hyderabad", "pincode":"503004" } # opening a JSON file in write mode with open('outputfile.json', 'w') as json_file: # writing the dictionary data into the corresponding JSON file # by adding indent parameter to make it attractive with proper indentation json.dump(inputDict, json_file, indent=5) Output

On executing, the above program will generate the following output −

{ "website": "Tutorialspoint", "authorName": "xyz", "Age": 25, "Address": "hyderabad", "pincode": "503004" }

A file named outputfile.json is created containing the above dictionary data with a proper indentation for making it more pretty.

Sorting the Keys in JSON

We can sort the keys of a dictionary alphabetically using the sort_keys = True parameter.

The following program converts the given dictionary to a sorted JSON file with indentation using the json.dump() function and sort_keys argument−

# importing JSON module import json # creating a dictionary inputDict = { "website": "Tutorialspoint", "authorName": "xyz", "Age": 25, "Address": "hyderabad", "pincode":"503004" } # opening a JSON file in write mode with open('outputfile.json', 'w') as json_file: # writing the dictionary data into the corresponding JSON file # indent parameter- to make it attractive with proper indentation # sort_keys- sorts the dictionary keys alphabetically json.dump(inputDict, json_file, indent=5, sort_keys=True) Output { "Address": "hyderabad", "Age": 25, "authorName": "xyz", "pincode": "503004", "website": "Tutorialspoint" }

The keys are now sorted alphabetically, as seen above.

Separators are an additional argument that can be used. In this, you can use any separator you like (“, “, “: “, “,”, “:”).

Converting Python List to JSON Example

The following program converts the python list to JSON string using dumps() function −

# importing JSON module import json # input list inputList = [2, 4, 6, 7] # converting input list into JSON string using dumps() function jsonString = json.dumps(inputList) # printing the resultant JSON string print(jsonString) # printing the type of resultant JSON string print(type(jsonString)) Output [2, 4, 6, 7] Converting Directories Python List to JSON Example

The following program converts the Directories python list to JSON string. using dumps() function −

# importing json module import json # input list of dictionaries list_dict = [{'x':10, 'y':20, 'z':30}, {'p':40, 'q':50}] # converting list of dictionaries into json string jsonData = json.dumps(list_dict) # printing the JSON data print(jsonData) Output [{"x": 10, "y": 20, "z": 30}, {"p": 40, "q": 50}] Converting Python List of Lists to JSON Example

The following program converts the Python List of Lists to JSON string using dumps() function −

# importing JSON module import json # input list of lists list_of_list = [[{'x':10, 'y':20, 'z':30}], [{'p':40, 'q':50}]] # converting a list of list into JSON string jsonString = json.dumps(list_of_list) # printing the resultant JSON string print(jsonString) Output

[[{"x": 10, "y": 20, "z": 30}], [{"p": 40, "q": 50}]]


This article contains a variety of techniques for converting various data formats to JSON files, JSON strings, etc. json.dumps(), which is used to convert any form of iterable to JSON, has also been covered in depth.

Update the detailed information about How To Format Write Protected Usb Pendrive on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!